Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: wait for the name update finish #30663

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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