Skip to content

Commit

Permalink
add log
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensJourney committed Feb 11, 2025
1 parent ef2f2fd commit 4cc26ed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/web/tests/stream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ describe(
});

itWithGenerators('Should retry failed uploads when connected', async (createConnectedDatabase) => {
console.log('connecting');
connectionUtilities = await createConnectedDatabase();
console.log('connected');
const { powersync, uploadSpy } = connectionUtilities;

expect(powersync.connected).toBe(true);
Expand All @@ -199,18 +201,23 @@ describe(
if (uploadCounter++ < throwCounter) {
throw new Error('No uploads yet');
}
console.log('allowing the upload');
// Now actually do the upload
const tx = await db.getNextCrudTransaction();
await tx?.complete();
});

console.log('creating an item');
// do something which should trigger an upload
await powersync.execute('INSERT INTO users (id, name) VALUES (uuid(), ?)', ['name']);

console.log('done creating an item');

// It should try and upload
await vi.waitFor(
() => {
// to-have-been-called seems to not work after failing a check
console.log('the number of calls is ',uploadSpy.mock.calls.length);
expect(uploadSpy.mock.calls.length).equals(throwCounter + 1);
},
{
Expand Down

0 comments on commit 4cc26ed

Please sign in to comment.