Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelstroschein committed Oct 18, 2024
1 parent 9f54af7 commit a5dfd3d
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lix/packages/sdk/src/database/initDb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,16 @@ test("change edges can't reference themselves", async () => {
});
const db = initDb({ sqlite });

try {
await db
await expect(
db
.insertInto("change_edge")
.values({
parent_id: "change1",
child_id: "change1",
})
.returningAll()
.execute();
} catch (error) {
// the sqite3 error is not exposed
expect((error as any).name).toBe("SQLite3Error");
// error code 275 = SQLITE_CONSTRAINT_CHECK
expect((error as any).resultCode).toBe(275);
}
.execute(),
).rejects.toThrowErrorMatchingInlineSnapshot(
`[SQLite3Error: SQLITE_CONSTRAINT_CHECK: sqlite3 result code 275: CHECK constraint failed: parent_id != child_id]`,
);
});

0 comments on commit a5dfd3d

Please sign in to comment.