@@ -40,8 +40,10 @@ test('Test hybrid api data flow server side.', async (t) => {
40
40
const window = await nuxt . renderAndGetWindow ( URL ( '/' ) ) ;
41
41
const path = window . document . querySelector ( '.index span.path' ) ;
42
42
const okay = window . document . querySelector ( '.index span.okay' ) ;
43
+ const resMiddle = window . document . querySelector ( '.index span.response-middleware' ) ;
43
44
44
45
t . is ( okay . textContent , "It's okay!" ) ;
46
+ t . is ( resMiddle . textContent , "It's okay!" ) ;
45
47
46
48
// Since it accessed to controller on server side, the request path should be '/' which was what we rendered above
47
49
t . is ( path . textContent , '/' ) ;
@@ -54,11 +56,13 @@ test('Test hybrid api data flow client side', async (t) => {
54
56
const okay = window . document . querySelector ( '.index span.okay' ) ;
55
57
const idParam = window . document . querySelector ( '.index span.id-param' ) ;
56
58
const changePath = window . document . querySelector ( '.index .change-path' ) ;
59
+ const resMiddle = window . document . querySelector ( '.index span.response-middleware' ) ;
57
60
58
61
changePath . dispatchEvent ( clickEvent ) ;
59
62
await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ; // wait for API request
60
63
61
64
t . is ( path . textContent , '/api/v2/users/1' ) ;
62
65
t . is ( okay . textContent , "It's okay!" ) ;
63
66
t . is ( idParam . textContent , '1' ) ;
67
+ t . is ( resMiddle . textContent , "It's okay!" ) ;
64
68
} ) ;
0 commit comments