Skip to content

Commit 654fc28

Browse files
committed
Fixing tests deletion
1 parent 6978967 commit 654fc28

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

components/pryv/test/Connection.test.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ describe('[CONX] Connection', () => {
2323
await testData.prepare();
2424
conn = new pryv.Connection(testData.apiEndpointWithToken);
2525

26-
// create some events
27-
const toBeDeletedId = cuid();
28-
const toBeTrashed = cuid();
26+
// create some events (prefix with 'c' for v2 event ID pattern)
27+
const toBeDeletedId = 'c' + cuid();
28+
const toBeTrashed = 'c' + cuid();
2929
await conn.api([
3030
{
3131
method: 'events.create',
@@ -375,6 +375,18 @@ describe('[CONX] Connection', () => {
375375
});
376376

377377
it('[CSNB] streaming includesDeletion', async () => {
378+
// Create, trash, and delete events to ensure we have all three states
379+
const trashId = 'c' + cuid();
380+
const deleteId = 'c' + cuid();
381+
const setupRes = await conn.api([
382+
{ method: 'events.create', params: { id: trashId, streamIds: ['data'], type: 'note/txt', content: 'to trash' } },
383+
{ method: 'events.create', params: { id: deleteId, streamIds: ['data'], type: 'note/txt', content: 'to delete' } },
384+
{ method: 'events.delete', params: { id: trashId } },
385+
{ method: 'events.delete', params: { id: deleteId } },
386+
{ method: 'events.delete', params: { id: deleteId } }
387+
]);
388+
// Verify setup succeeded
389+
expect(setupRes[0].event, 'event creation failed: ' + JSON.stringify(setupRes[0].error)).to.exist;
378390
const queryParams = { fromTime: 0, toTime: now, limit: 10000, includeDeletions: true, modifiedSince: 0, state: 'all' };
379391
let eventsCount = 0;
380392
let trashedCount = 0;

0 commit comments

Comments
 (0)