From 39f291cdeb036474a5682120fbb5d285a936e2ea Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Tue, 11 Nov 2025 22:45:17 -0500 Subject: [PATCH] move CacheManagementServiceTests to correct location --- .../CacheManagementServiceTests.ts} | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) rename packages/backend/test/unit/{core/CacheManagementService.ts => global/CacheManagementServiceTests.ts} (91%) diff --git a/packages/backend/test/unit/core/CacheManagementService.ts b/packages/backend/test/unit/global/CacheManagementServiceTests.ts similarity index 91% rename from packages/backend/test/unit/core/CacheManagementService.ts rename to packages/backend/test/unit/global/CacheManagementServiceTests.ts index 79b580ed7c..948ef2da3f 100644 --- a/packages/backend/test/unit/core/CacheManagementService.ts +++ b/packages/backend/test/unit/global/CacheManagementServiceTests.ts @@ -100,22 +100,22 @@ describe(CacheManagementService, () => { } function testClear(func: 'clear' | 'dispose' | 'onApplicationShutdown', shouldDispose: boolean) { - const act = () => serviceUnderTest[func](); + const act = async () => await serviceUnderTest[func](); - it('should clear managed caches', () => { + it('should clear managed caches', async () => { const cache = createCache(); const clear = jest.spyOn(cache, 'clear'); - act(); + await act(); expect(clear).toHaveBeenCalled(); }); - it(`should${shouldDispose ? ' ' : ' not '}dispose managed caches`, () => { + it(`should${shouldDispose ? ' ' : ' not '}dispose managed caches`, async () => { const cache = createCache(); const dispose = jest.spyOn(cache, 'dispose'); - act(); + await act(); if (shouldDispose) { expect(dispose).toHaveBeenCalled(); @@ -124,26 +124,26 @@ describe(CacheManagementService, () => { } }); - it('should not error with nothing to do', () => { - act(); + it('should not error with nothing to do', async () => { + await act(); }); - it('should be callable multiple times', () => { + it('should be callable multiple times', async () => { const cache = createCache(); const clear = jest.spyOn(cache, 'clear'); - act(); - act(); - act(); + await act(); + await act(); + await act(); const expected = shouldDispose ? 1 : 3; expect(clear).toHaveBeenCalledTimes(expected); }); - it(`should${shouldDispose ? ' ' : ' not '}deref caches`, () => { + it(`should${shouldDispose ? ' ' : ' not '}deref caches`, async () => { const cache = createCache(); - act(); + await act(); if (shouldDispose) { expect(internalsUnderTest.managedCaches.values()).not.toContain(cache); @@ -152,10 +152,10 @@ describe(CacheManagementService, () => { } }); - it(`should${shouldDispose ? ' ' : ' not '}reset cache list`, () => { + it(`should${shouldDispose ? ' ' : ' not '}reset cache list`, async () => { createCache(); - act(); + await act(); if (shouldDispose) { expect(internalsUnderTest.managedCaches.size).toBe(0);