Skip to content

Commit

Permalink
Have service.login() call expect(200) (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-white authored Jan 28, 2023
1 parent 1c30cd9 commit 50894bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions test/integration/api/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ describe('api: /users', () => {
asAlice.post('/v1/users')
.send({ email: '[email protected]', password: '' })
.expect(200) // treats a blank password as no password provided
.then(() => service.login({ email: '[email protected]', password: '' }, (failed) =>
failed.get('/v1/users/current').expect(401))))));
.then(() => service.post('/v1/sessions')
.send({ email: '[email protected]', password: '' })
.expect(400)))));

it('should not accept a password that is too short', testService((service) =>
service.login('alice', (asAlice) =>
Expand Down
4 changes: 3 additions & 1 deletion test/integration/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ const augment = (service) => {
const credentials = (typeof user === 'string')
? { email: `${user}@getodk.org`, password: user }
: user;
const { body } = await service.post('/v1/sessions').send(credentials);
const { body } = await service.post('/v1/sessions')
.send(credentials)
.expect(200);
return body.token;
}));
const proxies = tokens.map((token) => new Proxy(service, authProxy(token)));
Expand Down

0 comments on commit 50894bd

Please sign in to comment.