Skip to content

Commit

Permalink
fixup tests for main cr-sqlite build
Browse files Browse the repository at this point in the history
  • Loading branch information
tantaman committed Aug 28, 2023
1 parent cdc5324 commit ce570af
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
10 changes: 7 additions & 3 deletions packages/node-allinone/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type Changeset = [
any, // val,
Version,
Version,
SiteIDWire // site_id
SiteIDWire, // site_id
];

// test that we wrapped correctly
Expand Down Expand Up @@ -83,7 +83,10 @@ test("failing example", () => {
const siteid = db1.execA(`SELECT crsql_site_id()`)[0][0];
db2.transaction(() => {
for (const cs of changesets) {
db2.exec(`INSERT INTO crsql_changes VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, cs);
db2.exec(
`INSERT INTO crsql_changes VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
cs
);
}
});

Expand Down Expand Up @@ -178,10 +181,11 @@ test("failing two -- discord: https://discord.com/channels/989870439897653248/98
123,
1,
1,
0,
] as const;

db.exec(
`INSERT INTO crsql_changes ("cid", "pk", "site_id", "table", "val", "col_version", "db_version") VALUES (?,?,?,?,?,?,?)`,
`INSERT INTO crsql_changes ("cid", "pk", "site_id", "table", "val", "col_version", "db_version", "seq") VALUES (?,?,?,?,?,?,?,?)`,
change
);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/node-tests/src/__tests__/merge-check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const sync = (left: DB, right: DB) => {
// apply changes to right
right.transaction(() => {
const stmt = right.prepare(
"INSERT INTO crsql_changes VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
"INSERT INTO crsql_changes VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
);
try {
for (const cs of changesets) {
Expand Down
2 changes: 2 additions & 0 deletions packages/node-tests/src/__tests__/user-reports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ test("failed to increment?", () => {
db_version: 2,
site_id: null,
cl: 1,
seq: 0,
},
{
table: "b",
Expand All @@ -70,6 +71,7 @@ test("failed to increment?", () => {
db_version: 3,
site_id: null,
cl: 1,
seq: 0,
},
]);
});
4 changes: 0 additions & 4 deletions packages/ws-litefs/src/LiteFSDBFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ export class LiteFSDBFactory implements IDBFactory {
schemaVersion: bigint
): Promise<IDB> {
if (!this.#primaryConnection.isPrimary()) {
// If we are not primary then:
// 1. Create the DB on the primary
// 2. Get the TXID back
// 3. Wait for our DB to match that txid
const response = await this.#primaryConnection.createDbOnPrimary(
room,
schemaName,
Expand Down

0 comments on commit ce570af

Please sign in to comment.