Skip to content

Commit

Permalink
fix race condition in test
Browse files Browse the repository at this point in the history
  • Loading branch information
fergiemcdowall committed Jun 13, 2023
1 parent 84286c1 commit ce06ccd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/src/LAST_UPDATED-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ test('can read LAST_UPDATED timestamp with API', t => {

test('when adding a new doc, LAST_UPDATE increments', t => {
t.plan(1)
global[indexName].PUT([{
text: 'this is a new doc'.split()
}]).then(global[indexName].LAST_UPDATED)
.then(newTimestamp => t.ok(newTimestamp > timestamp))
setTimeout(function () { // wait to ensure that newer timestamp is bigger
global[indexName].PUT([{
text: 'this is a new doc'.split()
}]).then(global[indexName].LAST_UPDATED)
.then(newTimestamp => t.ok(newTimestamp > timestamp))
}, 100)
})

0 comments on commit ce06ccd

Please sign in to comment.