Skip to content

Commit 50894bd

Browse files
Have service.login() call expect(200) (getodk#752)
1 parent 1c30cd9 commit 50894bd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

test/integration/api/users.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ describe('api: /users', () => {
9696
asAlice.post('/v1/users')
9797
.send({ email: '[email protected]', password: '' })
9898
.expect(200) // treats a blank password as no password provided
99-
.then(() => service.login({ email: '[email protected]', password: '' }, (failed) =>
100-
failed.get('/v1/users/current').expect(401))))));
99+
.then(() => service.post('/v1/sessions')
100+
.send({ email: '[email protected]', password: '' })
101+
.expect(400)))));
101102

102103
it('should not accept a password that is too short', testService((service) =>
103104
service.login('alice', (asAlice) =>

test/integration/setup.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ const augment = (service) => {
131131
const credentials = (typeof user === 'string')
132132
? { email: `${user}@getodk.org`, password: user }
133133
: user;
134-
const { body } = await service.post('/v1/sessions').send(credentials);
134+
const { body } = await service.post('/v1/sessions')
135+
.send(credentials)
136+
.expect(200);
135137
return body.token;
136138
}));
137139
const proxies = tokens.map((token) => new Proxy(service, authProxy(token)));

0 commit comments

Comments
 (0)