File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,17 @@ describe('API routes', () => {
8
8
9
9
describe ( 'Extended API routes' , ( ) => {
10
10
it ( 'returns HTTP 202 Accepted for background route' , ( ) => {
11
- cy . request ( '/api/hello-background' ) . then ( ( response ) => {
12
- expect ( response . status ) . to . equal ( 202 )
11
+ cy . request ( 'POST' , 'https://webhook.site/token' ) . then ( ( tokenResponse ) => {
12
+ const token = tokenResponse . body . uuid
13
+ cy . request ( 'POST' , `/api/hello-background` , { token } ) . then ( ( response ) => {
14
+ expect ( response . status ) . to . equal ( 202 )
15
+
16
+ cy . wait ( 100 )
17
+
18
+ cy . request ( `https://webhook.site/token/${ token } /request/latest` ) . then ( response => {
19
+ expect ( response . status ) . to . equal ( 200 )
20
+ } )
21
+ } )
13
22
} )
14
23
} )
15
24
it ( 'correctly returns 404 for scheduled route' , ( ) => {
Original file line number Diff line number Diff line change 1
- export default ( req , res ) => {
1
+ export default async ( req , res ) => {
2
+ // await fetch(`https://webhook.site/${req.body.token}`)
3
+
2
4
res . setHeader ( 'Content-Type' , 'application/json' )
3
5
res . status ( 200 )
4
6
res . json ( { message : 'hello world :)' } )
You can’t perform that action at this time.
0 commit comments