Skip to content

Commit bd4ef72

Browse files
committed
Fix login tests for whoami route.
1 parent 29dc9b5 commit bd4ef72

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

test/login.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,6 @@ describe('Login', function() {
874874
assert.fail('Expected error but got success');
875875
} catch (err) {
876876
assert.strictEqual(err.status, 404);
877-
assert(err.message.includes('notfound'));
878877
}
879878
});
880879

@@ -888,7 +887,7 @@ describe('Login', function() {
888887
method: 'POST',
889888
body: {
890889
username: 'HarryPutter',
891-
password: 'crookshanks',
890+
password: 'AnotherLovelyPassword',
892891
session: true
893892
},
894893
jar
@@ -898,7 +897,7 @@ describe('Login', function() {
898897
const whoamiResponse = await apos.http.get('/api/v1/@apostrophecms/login/whoami', { jar });
899898
assert.ok(whoamiResponse._id);
900899
assert.strictEqual(whoamiResponse.username, 'HarryPutter');
901-
assert.strictEqual(whoamiResponse.title, 'Harry Putter');
900+
assert.strictEqual(whoamiResponse.title, 'Extra Cool Putter');
902901
assert.strictEqual(whoamiResponse.email, 'hputter@aol.com');
903902
});
904903

@@ -914,7 +913,7 @@ describe('Login', function() {
914913
method: 'POST',
915914
body: {
916915
username: 'HarryPutter',
917-
password: 'crookshanks',
916+
password: 'AnotherLovelyPassword',
918917
session: true
919918
},
920919
jar
@@ -929,13 +928,16 @@ describe('Login', function() {
929928

930929
const jar = apos.http.jar();
931930

931+
// Reset the whoamiFields to default (empty)
932+
apos.modules['@apostrophecms/login'].options.whoamiFields = [];
933+
932934
await apos.http.post(
933935
'/api/v1/@apostrophecms/login/login',
934936
{
935937
method: 'POST',
936938
body: {
937939
username: 'HarryPutter',
938-
password: 'crookshanks',
940+
password: 'AnotherLovelyPassword',
939941
session: true
940942
},
941943
jar

0 commit comments

Comments
 (0)