mirror of
https://github.com/immich-app/immich.git
synced 2026-03-22 22:29:52 +03:00
refactor: use makeStream for 2nd case; update makeStream type
Signed-off-by: izzy <me@insrt.uk>
This commit is contained in:
@@ -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* () {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user