Updated mocha & nyc, resolved all lint issues in tests/

This commit is contained in:
2022-08-20 13:05:24 +02:00
parent 9708a6cff9
commit a6d808daa6
18 changed files with 996 additions and 1207 deletions

View File

@@ -4,17 +4,20 @@ const app = require("../../src/webserver/app");
const createUser = require("../helpers/createUser");
const resetDatabase = require("../helpers/resetDatabase");
describe('As a user I want error when registering existing username', () => {
before(() => {
return resetDatabase()
.then(() => createUser('test_user', 'password'))
})
describe("As a user I want error when registering existing username", () => {
beforeEach(() => {
return resetDatabase().then(() => createUser("test_user", "password"));
});
it('should return 401 with error message when same username is given', () =>
it("should return 401 with error message when same username is given", () =>
request(app)
.post('/api/v1/user')
.send({ username: 'test_user', password: 'password' })
.expect(401)
.then(response => assert.equal(response.text, '{"success":false,"message":"That username is already registered"}'))
);
.post("/api/v1/user")
.send({ username: "test_user", password: "password" })
.expect(401)
.then(response =>
assert.equal(
response.text,
'{"success":false,"message":"That username is already registered"}'
)
));
});