lint fixes

This commit is contained in:
Aaro Koivukangas
2024-10-30 19:29:05 +02:00
committed by Sampo
parent 778f462065
commit 4ef404ce0f
3 changed files with 22 additions and 22 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ describe('Creating an user', () => {
await pool.end()
})
it.todo("is successful with correct data")
it.todo("is not successfull with missing data")
it.todo("is not successfull with incorrect password")
it.todo('is successful with correct data')
it.todo('is not successfull with missing data')
it.todo('is not successfull with incorrect password')
})
+8 -8
View File
@@ -1,17 +1,17 @@
export const testSu = {
username: "testSu",
password: "test"
username: 'testSu',
password: 'test',
}
export const newUser = {
username: "charliechaplin123",
password: "mutefilms",
initials: "CC",
role: "su",
secret: "abcdefg"
username: 'charliechaplin123',
password: 'mutefilms',
initials: 'CC',
role: 'su',
secret: 'abcdefg',
}
export default {
testSu,
newUser
newUser,
}
+11 -11
View File
@@ -1,7 +1,7 @@
import { beforeAll, afterAll, describe, it, expect } from '@jest/globals'
import { resetDatabase, send, resetDatabaseTimeout } from '../utils'
import { pool } from '../../utils/db'
import { testSu } from "./data"
import { testSu } from './data'
describe('Logging in', () => {
beforeAll(async () => {
@@ -11,29 +11,29 @@ describe('Logging in', () => {
await pool.end()
})
it("is successful with test admin user", async () => {
const result = await send("user/login", "POST", testSu)
it('is successful with test admin user', async () => {
const result = await send('user/login', 'POST', testSu)
expect(result.status).toEqual(200)
expect(result.body.username).toEqual("testSu")
expect(result.body.username).toEqual('testSu')
expect(result.body.role).toEqual(1) // frontend/src/types: Role enum
expect(result.body.isFirstLogin).toEqual(undefined)
})
it("is not successfull with missing data", async () => {
const resultNoUsername = await send("user/login", "POST", { password: "test" })
const resultNoPassword = await send("user/login", "POST", { username: "testSu" })
it('is not successfull with missing data', async () => {
const resultNoUsername = await send('user/login', 'POST', { password: 'test' })
const resultNoPassword = await send('user/login', 'POST', { username: 'testSu' })
expect(resultNoUsername.status).toEqual(403)
expect(resultNoPassword.status).toEqual(403)
const resultEmptyUsername = await send("user/login", "POST", { username: "", password: "test" })
const resultEmptyPassword = await send("user/login", "POST", { username: "testSu", password: "" })
const resultEmptyUsername = await send('user/login', 'POST', { username: '', password: 'test' })
const resultEmptyPassword = await send('user/login', 'POST', { username: 'testSu', password: '' })
expect(resultEmptyUsername.status).toEqual(403)
expect(resultEmptyPassword.status).toEqual(403)
})
it("is not successfull with incorrect password", async () => {
const result = await send("user/login", "POST", { username: "testSu", password: "Test"})
it('is not successfull with incorrect password', async () => {
const result = await send('user/login', 'POST', { username: 'testSu', password: 'Test' })
expect(result.status).toEqual(403)
})
})