refactor: use makeStream for 2nd case; update makeStream type

Signed-off-by: izzy <me@insrt.uk>
This commit is contained in:
izzy
2026-02-12 12:09:58 +00:00
parent 6b7ac81dcc
commit f6d88ffa96
2 changed files with 2 additions and 7 deletions

View File

@@ -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* () {

View File

@@ -569,7 +569,7 @@ export const mockFork = vitest.fn((exitCode: number, stdout: string, stderr: str
} as unknown as ChildProcessWithoutNullStreams;
});
export async function* makeStream<T>(items: T[] = []): AsyncIterableIterator<T> {
export async function* makeStream<T>(items: T[] = []): AsyncGenerator<T> {
for (const item of items) {
await Promise.resolve();
yield item;