blink/backend/apis/nodejs/tests/person.test.js

31 lines
826 B
JavaScript
Raw Normal View History

2024-02-21 12:51:33 +01:00
// Run me with "npm test"
2024-02-22 17:30:31 +01:00
const request = require('supertest')
const app = require('../src/app')
require('dotenv').config({ path: '../src/.env' })
2024-02-21 12:51:33 +01:00
describe('Person Tests', () => {
test('Correct registration', async () => {
const response = await request(app)
2024-02-22 17:30:31 +01:00
.post('/api/register')
.send({
email: 'johntestdoe@mail.org',
password: 'password',
display_name: 'John Doe'
})
expect(response.status).toBe(200)
expect(response.body).toEqual({ activationLink: expect.any(String) })
})
2024-02-21 12:51:33 +01:00
test('Incorrect registration', async () => {
const response = await request(app)
2024-02-22 17:30:31 +01:00
.post('/api/register')
.send({
email: 'this is not an email',
password: 'password',
display_name: 'John Doe'
})
expect(response.status).toBe(400)
})
})