Skip to content

Commit

Permalink
test: wait for the name update finish
Browse files Browse the repository at this point in the history
  • Loading branch information
tapiarafael committed Oct 17, 2023
1 parent dd5b236 commit a397684
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions apps/meteor/tests/end-to-end/api/09-rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1570,29 +1570,30 @@ describe('[Rooms]', function () {
});
});

it('should update group name if user changes name', (done) => {
updateSetting('UI_Use_Real_Name', true).then(() => {
request
.post(api('users.update'))
.set(credentials)
.send({
userId: testUser._id,
data: {
name: `changed.name.${testUser.username}`,
},
})
.end(() => {
request
.get(api('subscriptions.getOne'))
.set(credentials)
.query({ roomId })
.end((err, res) => {
const { subscription } = res.body;
expect(subscription.fname).to.equal(`changed.name.${testUser.username}, Rocket.Cat`);
done();
});
});
});
it('should update group name if user changes name', async () => {
await updateSetting('UI_Use_Real_Name', true);
await request
.post(api('users.update'))
.set(credentials)
.send({
userId: testUser._id,
data: {
name: `changed.name.${testUser.username}`,
},
});

// need to wait for the name update finish
await sleep(300);

await request
.get(api('subscriptions.getOne'))
.set(credentials)
.query({ roomId })
.send()
.expect((res) => {
const { subscription } = res.body;
expect(subscription.fname).to.equal(`changed.name.${testUser.username}, Rocket.Cat`);
});
});
});

Expand Down

0 comments on commit a397684

Please sign in to comment.