-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdatabase.test.imba
More file actions
38 lines (28 loc) · 729 Bytes
/
database.test.imba
File metadata and controls
38 lines (28 loc) · 729 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
jest.mock '@paralleldrive/cuid2'
const formidable = require('../.formidable/build').default
const supertest = require('supertest')
describe 'Database', do
let app
beforeAll do
const application = await formidable
app = application.fastify()
await app.ready()
afterAll do
await app.close()
it '/ (PUT: Create Post)', do
supertest(app.server)
.put('/posts')
.send({ body: 'hello world' })
.expect(200)
it '/ (GET: Fetch all posts)', do
supertest(app.server)
.get('/posts')
.expect(200)
it '/ (GET: Fetch 1 post)', do
supertest(app.server)
.get('/posts/1')
.expect(200)
it '/ (GET: Fetch 1 post) - throw error', do
supertest(app.server)
.get('/posts/100000')
.expect(404)