diff --git a/server/src/services/integrity.service.spec.ts b/server/src/services/integrity.service.spec.ts index 5cf6bf4557..e8b388b43c 100644 --- a/server/src/services/integrity.service.spec.ts +++ b/server/src/services/integrity.service.spec.ts @@ -154,12 +154,7 @@ describe(IntegrityService.name, () => { }); it('queues jobs for all detected files', async () => { - mocks.storage.walk.mockReturnValueOnce( - (function* () { - yield ['/path/to/file', '/path/to/file2']; - yield ['/path/to/batch2']; - })() as never, - ); + mocks.storage.walk.mockReturnValueOnce(makeStream([['/path/to/file', '/path/to/file2'], ['/path/to/batch2']])); mocks.storage.walk.mockReturnValueOnce( (function* () { diff --git a/server/test/utils.ts b/server/test/utils.ts index f5368555a8..b73ca96df3 100644 --- a/server/test/utils.ts +++ b/server/test/utils.ts @@ -569,7 +569,7 @@ export const mockFork = vitest.fn((exitCode: number, stdout: string, stderr: str } as unknown as ChildProcessWithoutNullStreams; }); -export async function* makeStream(items: T[] = []): AsyncIterableIterator { +export async function* makeStream(items: T[] = []): AsyncGenerator { for (const item of items) { await Promise.resolve(); yield item;