-
-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy pathextensions.ts
43 lines (39 loc) · 1.04 KB
/
extensions.ts
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
import { expect, test } from 'vitest'
import { app } from './utils'
test('extension list filtering', async () => {
const res = await app.inject({
method: 'GET',
path: '/extensions?limit=5',
})
expect(res.statusCode).toBe(200)
const extensions = res.json()
expect(Array.isArray(extensions)).toBe(true)
expect(extensions.length).toBeLessThanOrEqual(5)
})
test('extension with invalid id', async () => {
const res = await app.inject({
method: 'GET',
path: '/extensions/99999999',
})
expect(res.statusCode).toBe(404)
})
test('create extension with invalid name', async () => {
const res = await app.inject({
method: 'POST',
path: '/extensions',
payload: {
name: 'invalid_extension_name_that_doesnt_exist',
schema: 'public',
version: '1.0',
cascade: false,
},
})
expect(res.statusCode).toBe(400)
})
test('delete extension with invalid id', async () => {
const res = await app.inject({
method: 'DELETE',
path: '/extensions/99999999',
})
expect(res.statusCode).toBe(404)
})