-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathauth.test.imba
More file actions
46 lines (37 loc) · 863 Bytes
/
auth.test.imba
File metadata and controls
46 lines (37 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
jest.mock '@paralleldrive/cuid2'
const formidable = require('../.formidable/build').default
const supertest = require('supertest')
describe 'Auth', do
let app
beforeAll do
const application = await formidable
app = application.fastify()
await app.ready()
afterAll do
await app.close()
it '/ (POST: Create User)', do
supertest(app.server)
.post('/register')
.send({
name: 'Donald'
email: 'test@example.com'
password: 'password'
password_confirmation: 'password'
})
.expect(200)
it '/ (POST: Login - success)', do
supertest(app.server)
.post('/login')
.send({
email: 'test@example.com'
password: 'password'
})
.expect(200)
it '/ (POST: Login - failure)', do
supertest(app.server)
.post('/login')
.send({
email: 'test@example.com'
password: 'password1'
})
.expect(422)