|
|
@@ -1,5 +1,6 @@
|
|
|
const { expect } = require('chai')
|
|
|
const { ObjectId } = require('mongodb')
|
|
|
+const Settings = require('@overleaf/settings')
|
|
|
const User = require('./helpers/User').promises
|
|
|
|
|
|
describe('Authentication', function () {
|
|
|
@@ -71,4 +72,22 @@ describe('Authentication', function () {
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+ describe('failed login', function () {
|
|
|
+ beforeEach('fetchCsrfToken', async function () {
|
|
|
+ await user.getCsrfToken()
|
|
|
+ })
|
|
|
+ it('should return a 401', async function () {
|
|
|
+ const {
|
|
|
+ response: { statusCode },
|
|
|
+ } = await user.doRequest('POST', {
|
|
|
+ url: Settings.enableLegacyLogin ? '/login/legacy' : '/login',
|
|
|
+ json: {
|
|
|
+ email: user.email,
|
|
|
+ password: 'foo-bar-baz',
|
|
|
+ },
|
|
|
+ })
|
|
|
+ expect(statusCode).to.equal(401)
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|