Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kpoke committed Feb 21, 2022
1 parent aa88d39 commit 161b89b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions server/__tests__/integration/capture/capture.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ describe('/captures', () => {
.expect(204);

// added a timer to confirm this because the function call in the API is not 'awaited'
setTimeout(async () => {
const numOfEmittedEvents = await knex('domain_event')
.count()
.where({ status: 'sent' });
expect(+numOfEmittedEvents[0].count).to.eql(2);
}, 5000);
await new Promise((resolve) => setTimeout(resolve, 2000));
const numOfEmittedEvents = await knex('domain_event')
.count()
.where({ status: 'sent' });
expect(+numOfEmittedEvents[0].count).to.eql(2);
});

after(async () => {
Expand Down
11 changes: 5 additions & 6 deletions server/__tests__/integration/tree/tree.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ describe('/trees', () => {
.expect(204);

// added a timer to confirm this because the function call in the API is not 'awaited'
setTimeout(async () => {
const numOfEmittedEvents = await knex('domain_event')
.count()
.where({ status: 'sent' });
expect(+numOfEmittedEvents[0].count).to.eql(2);
}, 5000);
await new Promise((resolve) => setTimeout(resolve, 2000));
const numOfEmittedEvents = await knex('domain_event')
.count()
.where({ status: 'sent' });
expect(+numOfEmittedEvents[0].count).to.eql(2);
});

after(async () => {
Expand Down

0 comments on commit 161b89b

Please sign in to comment.