-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathExposedServerFunctions.test.js
More file actions
77 lines (65 loc) · 3.05 KB
/
ExposedServerFunctions.test.js
File metadata and controls
77 lines (65 loc) · 3.05 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
beforeAll(async () => {
await page.goto('http://localhost:6969/exposed-server-functions')
})
describe('ExposedServerFunctions', () => {
test('routes are chainable when receiving a server function', async () => {
await page.waitForSelector('[data-chainable-server-function]')
const element = await page.$('[data-chainable-server-function]')
expect(element).toBeTruthy()
})
test('routes are chainable when receiving a regular function', async () => {
await page.waitForSelector('[data-chainable-regular-function]')
const element = await page.$('[data-chainable-regular-function]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to GET and serialize params and query', async () => {
await page.waitForSelector('[data-get]')
const element = await page.$('[data-get]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to POST and serialize params and query and body as text', async () => {
await page.waitForSelector('[data-post]')
const element = await page.$('[data-post]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to POST and serialize params and query and body as json', async () => {
await page.waitForSelector('[data-post-json]')
const element = await page.$('[data-post-json]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to PUT and serialize params and query and body as text', async () => {
await page.waitForSelector('[data-put]')
const element = await page.$('[data-put]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to PUT and serialize params and query and body as json', async () => {
await page.waitForSelector('[data-put-json]')
const element = await page.$('[data-put-json]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to PATCH and serialize params and query and body as text', async () => {
await page.waitForSelector('[data-patch]')
const element = await page.$('[data-patch]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to PATCH and serialize params and query and body as json', async () => {
await page.waitForSelector('[data-patch-json]')
const element = await page.$('[data-patch-json]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to DELETE and serialize params and query and body as text', async () => {
await page.waitForSelector('[data-delete]')
const element = await page.$('[data-delete]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to DELETE and serialize params and query and body as json', async () => {
await page.waitForSelector('[data-delete-json]')
const element = await page.$('[data-delete-json]')
expect(element).toBeTruthy()
})
test('server functions can be exposed to ALL and serialize params and query and body', async () => {
await page.waitForSelector('[data-all]')
const element = await page.$('[data-all]')
expect(element).toBeTruthy()
})
})