mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 00:25:38 -04:00
fix: refactor duplicate active job constraint assertion in import processor test
This commit is contained in:
@@ -370,7 +370,8 @@ describe("processImportJob — state transitions", () => {
|
|||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
expect(() =>
|
let duplicateActiveJobRejected = false;
|
||||||
|
try {
|
||||||
testDb
|
testDb
|
||||||
.insert(importJobs)
|
.insert(importJobs)
|
||||||
.values({
|
.values({
|
||||||
@@ -390,8 +391,11 @@ describe("processImportJob — state transitions", () => {
|
|||||||
importRatings: true,
|
importRatings: true,
|
||||||
createdAt,
|
createdAt,
|
||||||
})
|
})
|
||||||
.run(),
|
.run();
|
||||||
).toThrow("UNIQUE constraint");
|
} catch {
|
||||||
|
duplicateActiveJobRejected = true;
|
||||||
|
}
|
||||||
|
expect(duplicateActiveJobRejected).toBe(true);
|
||||||
|
|
||||||
testDb.update(importJobs).set({ status: "success" }).where(eq(importJobs.id, "job-1")).run();
|
testDb.update(importJobs).set({ status: "success" }).where(eq(importJobs.id, "job-1")).run();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user