28 lines
781 B
TypeScript
28 lines
781 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { CacheUnavailableError } from "@/utils/cacheUtils/cacheUnavailableError.js";
|
|
import { JobName } from "@/queue/JobName.js";
|
|
import { shouldRetryQueueJobError } from "@/queue/processMessage.js";
|
|
|
|
describe("shouldRetryQueueJobError", () => {
|
|
test("retries track jobs on transient cache errors", () => {
|
|
expect(
|
|
shouldRetryQueueJobError({
|
|
jobName: JobName.Track,
|
|
error: new CacheUnavailableError({
|
|
source: "runTrackV3",
|
|
reason: "timeout",
|
|
}),
|
|
}),
|
|
).toBe(true);
|
|
});
|
|
|
|
test("does not retry track jobs on non-transient application errors", () => {
|
|
expect(
|
|
shouldRetryQueueJobError({
|
|
jobName: JobName.Track,
|
|
error: new Error("insufficient balance"),
|
|
}),
|
|
).toBe(false);
|
|
});
|
|
});
|