diff --git a/libs/movex/src/lib/movex-store/MemoryMovexStore.spec.ts b/libs/movex/src/lib/movex-store/MemoryMovexStore.spec.ts index 7a077243..15cbb752 100644 --- a/libs/movex/src/lib/movex-store/MemoryMovexStore.spec.ts +++ b/libs/movex/src/lib/movex-store/MemoryMovexStore.spec.ts @@ -136,40 +136,53 @@ describe('Concurrency', () => { describe('clearAll functionality', () => { test('clearAll with an empty store', async () => { const store = new MemoryMovexStore<{ counter: () => { count: number } }>(); - await store.clearAll(); + await store.clearAll().resolve(); + expect(store.all()).toEqual({}); }); test('newly created items are not there after clearAll', async () => { const store = new MemoryMovexStore<{ counter: () => { count: number } }>(); - await store.create('counter:1', { count: 1 }); - await store.clearAll(); + + await store.create('counter:1', { count: 1 }).resolve(); + await store.clearAll().resolve(); + expect(store.all()).toEqual({}); }); test('clearAll after items are updated', async () => { const store = new MemoryMovexStore<{ counter: () => { count: number } }>(); - await store.create('counter:1', { count: 1 }); - await store.updateState('counter:1', (prev) => ({ count: prev.count + 1 })); - await store.clearAll(); + + await store.create('counter:1', { count: 1 }).resolve(); + await store + .updateState('counter:1', (prev) => ({ count: prev.count + 1 })) + .resolve(); + await store.clearAll().resolve(); + expect(store.all()).toEqual({}); }); test('clearAll after items are removed', async () => { const store = new MemoryMovexStore<{ counter: () => { count: number } }>(); - await store.create('counter:1', { count: 1 }); - await store.remove('counter:1'); - await store.clearAll(); + + await store.create('counter:1', { count: 1 }).resolve(); + await store.remove('counter:1').resolve(); + await store.clearAll().resolve(); + expect(store.all()).toEqual({}); }); test('clearAll after multiple operations', async () => { const store = new MemoryMovexStore<{ counter: () => { count: number } }>(); - await store.create('counter:1', { count: 1 }); - await store.updateState('counter:1', (prev) => ({ count: prev.count + 1 })); - await store.remove('counter:1'); - await store.create('counter:2', { count: 2 }); - await store.clearAll(); + + await store.create('counter:1', { count: 1 }).resolve(); + await store + .updateState('counter:1', (prev) => ({ count: prev.count + 1 })) + .resolve(); + await store.remove('counter:1').resolve(); + await store.create('counter:2', { count: 2 }).resolve(); + await store.clearAll().resolve(); + expect(store.all()).toEqual({}); }); -});} \ No newline at end of file +});