Skip to content

Commit

Permalink
fix node tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tantaman committed Nov 27, 2023
1 parent 342e9c1 commit bad6a85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/node-tests/src/__tests__/automigrate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import crsqlite from "@vlcn.io/crsqlite-allinone";
test("automigrate", () => {
const db = crsqlite.open();
const schema = /*sql*/ `
CREATE TABLE IF NOT EXISTS test (id PRIMARY KEY, name TEXT);
CREATE TABLE IF NOT EXISTS test (id PRIMARY KEY NOT NULL, name TEXT);
SELECT crsql_as_crr('test');
`;
db.exec(`SELECT crsql_automigrate(?);`, [schema]);
Expand All @@ -15,7 +15,7 @@ test("automigrate", () => {
db.exec(`SELECT crsql_automigrate(?);`, [updatedSchema]);

const db2 = crsqlite.open();
const schema2 = `CREATE TABLE IF NOT EXISTS test (id PRIMARY KEY, name TEXT);
const schema2 = `CREATE TABLE IF NOT EXISTS test (id PRIMARY KEY NOT NULL, name TEXT);
SELECT crsql_as_crr('test');
`;
db2.exec(`SELECT crsql_automigrate(?);`, [schema]);
Expand Down
4 changes: 3 additions & 1 deletion packages/node-tests/src/__tests__/fract-check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import fc from "fast-check";
function setupDb() {
const db = crsqlite.open();

db.exec(`CREATE TABLE todo (id primary key, list_id, ordering, content)`);
db.exec(
`CREATE TABLE todo (id primary key not null, list_id, ordering, content)`
);
db.exec(`SELECT crsql_as_crr('todo')`);
db.exec(`SELECT crsql_fract_as_ordered('todo', 'ordering', 'list_id')`);

Expand Down
5 changes: 3 additions & 2 deletions packages/node-tests/src/__tests__/user-reports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ test("failed to increment?", () => {
INSERT INTO a VALUES (10, 123);
UPDATE b SET data = 10 WHERE data IS ${initial};
`);
const siteId = database.prepare(`SELECT crsql_site_id()`).pluck().get();
expect(database.prepare(`SELECT * FROM crsql_changes`).all()).toEqual([
{
table: "a",
Expand All @@ -58,7 +59,7 @@ test("failed to increment?", () => {
val: 123,
col_version: 1,
db_version: 2,
site_id: null,
site_id: siteId,
cl: 1,
seq: 0,
},
Expand All @@ -69,7 +70,7 @@ test("failed to increment?", () => {
val: 10,
col_version: 2,
db_version: 3,
site_id: null,
site_id: siteId,
cl: 1,
seq: 0,
},
Expand Down

0 comments on commit bad6a85

Please sign in to comment.