Skip to content

Commit

Permalink
Make flaky rebuild test async
Browse files Browse the repository at this point in the history
  • Loading branch information
Powersource committed Oct 19, 2023
1 parent e702f62 commit 33d73a3
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions test/rebuild.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ test('rebuild (I am added to a group, then someone else is added)', t => {
})
})

test('rebuild (not called when I invite another member)', t => {
test('rebuild (not called when I invite another member)', async t => {
const server = Server()

let rebuildCalled = false
Expand All @@ -214,22 +214,18 @@ test('rebuild (not called when I invite another member)', t => {
rebuild(...args)
})

server.tribes.create(null, (err, data) => {
t.error(err, 'I create a group')
const data = await p(server.tribes.create)(null)
const { groupId } = data

const { groupId } = data
const feedId = FeedId()
const feedId = FeedId()

server.tribes.invite(groupId, [feedId], {}, (err) => {
t.error(err, 'I add someone to the group')
await p(server.tribes.invite)(groupId, [feedId], {})

setTimeout(() => {
t.false(rebuildCalled, 'I did not rebuild my indexes')
server.close()
t.end()
}, 1e3)
})
})
await p(setTimeout)(1000)

t.false(rebuildCalled, 'I did not rebuild my indexes')

await p(server.close)()
})

test('rebuild from listen.addMember', t => {
Expand Down

0 comments on commit 33d73a3

Please sign in to comment.