feat(core-testing): RecordingJobQueue
Adds RecordingJobQueue implementing IJobQueue for use in unit tests. Records all enqueue calls with taskSlug/input/options and returns synthetic incrementing jobIds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import type { IJobQueue } from "@repo/core-shared/jobs";
|
||||
|
||||
export class RecordingJobQueue implements IJobQueue {
|
||||
readonly enqueued: { taskSlug: string; input: unknown; options?: { runAt?: Date } }[] = [];
|
||||
|
||||
async enqueue<T>(
|
||||
taskSlug: string,
|
||||
input: T,
|
||||
options?: { runAt?: Date },
|
||||
): Promise<{ jobId: string }> {
|
||||
this.enqueued.push({ taskSlug, input, options });
|
||||
return { jobId: `recording-${this.enqueued.length}` };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user