Skip to content

Commit

Permalink
Add end-to-end tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusbsilva137 committed Oct 9, 2024
1 parent e2e9838 commit 8e00521
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions apps/meteor/tests/end-to-end/api/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,44 @@ describe('[Users]', () => {
.end(done);
});

it('should return an error when trying to upsert a user by sending an empty userId', (done) => {
request
.post(api('users.update'))
.set(credentials)
.send({
userId: '',
data: {},
})
.expect('Content-Type', 'application/json')
.expect(400)
.expect((res) => {
expect(res.body).to.have.property('success', false);
expect(res.body).to.have.property('errorType', 'invalid-params');
expect(res.body).to.have.property('error', 'must NOT have fewer than 1 characters [invalid-params]');
})
.end(done);
});

it('should return an error when trying to use the joinDefaultChannels param, which is not intended for updates', (done) => {
request
.post(api('users.update'))
.set(credentials)
.send({
userId: targetUser._id,
data: {
joinDefaultChannels: true,
},
})
.expect('Content-Type', 'application/json')
.expect(400)
.expect((res) => {
expect(res.body).to.have.property('success', false);
expect(res.body).to.have.property('errorType', 'invalid-params');
expect(res.body).to.have.property('error', 'must NOT have additional properties [invalid-params]');
})
.end(done);
});

it("should update a bot's email", (done) => {
void request
.post(api('users.update'))
Expand Down

0 comments on commit 8e00521

Please sign in to comment.