File tree 6 files changed +28
-18
lines changed
packages/nextjs/test/integration/test/server
6 files changed +28
-18
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ const assert = require('assert');
3
3
const { sleep } = require ( '../utils/common' ) ;
4
4
const { getAsync, interceptEventRequest } = require ( '../utils/server' ) ;
5
5
6
- module . exports = async ( { url, argv } ) => {
6
+ module . exports = async ( { url : urlBase , argv } ) => {
7
+ const url = `${ urlBase } /api/error` ;
8
+
7
9
const capturedRequest = interceptEventRequest (
8
10
{
9
11
exception : {
@@ -18,15 +20,15 @@ module.exports = async ({ url, argv }) => {
18
20
runtime : 'node' ,
19
21
} ,
20
22
request : {
21
- url : ` ${ url } /api/error` ,
23
+ url,
22
24
method : 'GET' ,
23
25
} ,
24
26
transaction : 'GET /api/error' ,
25
27
} ,
26
28
argv ,
27
29
) ;
28
30
29
- await getAsync ( ` ${ url } /api/error` ) ;
31
+ await getAsync ( url ) ;
30
32
await sleep ( 100 ) ;
31
33
32
34
assert . ok ( capturedRequest . isDone ( ) , 'Did not intercept expected request' ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ const assert = require('assert');
3
3
const { sleep } = require ( '../utils/common' ) ;
4
4
const { getAsync, interceptEventRequest } = require ( '../utils/server' ) ;
5
5
6
- module . exports = async ( { url, argv } ) => {
6
+ module . exports = async ( { url : urlBase , argv } ) => {
7
+ const url = `${ urlBase } /withServerSideProps` ;
8
+
7
9
const capturedRequest = interceptEventRequest (
8
10
{
9
11
exception : {
@@ -18,14 +20,14 @@ module.exports = async ({ url, argv }) => {
18
20
runtime : 'node' ,
19
21
} ,
20
22
request : {
21
- url : '/withServerSideProps' ,
23
+ url,
22
24
method : 'GET' ,
23
25
} ,
24
26
} ,
25
27
argv ,
26
28
) ;
27
29
28
- await getAsync ( ` ${ url } /withServerSideProps` ) ;
30
+ await getAsync ( url ) ;
29
31
await sleep ( 100 ) ;
30
32
31
33
assert . ok ( capturedRequest . isDone ( ) , 'Did not intercept expected request' ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ const assert = require('assert');
3
3
const { sleep } = require ( '../utils/common' ) ;
4
4
const { getAsync, interceptTracingRequest } = require ( '../utils/server' ) ;
5
5
6
- module . exports = async ( { url, argv } ) => {
6
+ module . exports = async ( { url : urlBase , argv } ) => {
7
+ const url = `${ urlBase } /api/users` ;
8
+
7
9
const capturedRequest = interceptTracingRequest (
8
10
{
9
11
contexts : {
@@ -16,13 +18,13 @@ module.exports = async ({ url, argv }) => {
16
18
transaction : 'GET /api/users' ,
17
19
type : 'transaction' ,
18
20
request : {
19
- url : '/api/users' ,
21
+ url,
20
22
} ,
21
23
} ,
22
24
argv ,
23
25
) ;
24
26
25
- await getAsync ( ` ${ url } /api/users` ) ;
27
+ await getAsync ( url ) ;
26
28
await sleep ( 100 ) ;
27
29
28
30
assert . ok ( capturedRequest . isDone ( ) , 'Did not intercept expected request' ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ const assert = require('assert');
3
3
const { sleep } = require ( '../utils/common' ) ;
4
4
const { getAsync, interceptTracingRequest } = require ( '../utils/server' ) ;
5
5
6
- module . exports = async ( { url, argv } ) => {
6
+ module . exports = async ( { url : urlBase , argv } ) => {
7
+ const url = `${ urlBase } /api/missing` ;
7
8
const capturedRequest = interceptTracingRequest (
8
9
{
9
10
contexts : {
@@ -16,13 +17,13 @@ module.exports = async ({ url, argv }) => {
16
17
transaction : 'GET /404' ,
17
18
type : 'transaction' ,
18
19
request : {
19
- url : '/api/missing' ,
20
+ url,
20
21
} ,
21
22
} ,
22
23
argv ,
23
24
) ;
24
25
25
- await getAsync ( ` ${ url } /api/missing` ) ;
26
+ await getAsync ( url ) ;
26
27
await sleep ( 100 ) ;
27
28
28
29
assert . ok ( capturedRequest . isDone ( ) , 'Did not intercept expected request' ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ const assert = require('assert');
3
3
const { sleep } = require ( '../utils/common' ) ;
4
4
const { getAsync, interceptTracingRequest } = require ( '../utils/server' ) ;
5
5
6
- module . exports = async ( { url, argv } ) => {
6
+ module . exports = async ( { url : urlBase , argv } ) => {
7
+ const url = `${ urlBase } /api/broken` ;
7
8
const capturedRequest = interceptTracingRequest (
8
9
{
9
10
contexts : {
@@ -16,13 +17,13 @@ module.exports = async ({ url, argv }) => {
16
17
transaction : 'GET /api/broken' ,
17
18
type : 'transaction' ,
18
19
request : {
19
- url : '/api/broken' ,
20
+ url,
20
21
} ,
21
22
} ,
22
23
argv ,
23
24
) ;
24
25
25
- await getAsync ( ` ${ url } /api/broken` ) ;
26
+ await getAsync ( url ) ;
26
27
await sleep ( 100 ) ;
27
28
28
29
assert . ok ( capturedRequest . isDone ( ) , 'Did not intercept expected request' ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ const nock = require('nock');
5
5
const { sleep } = require ( '../utils/common' ) ;
6
6
const { getAsync, interceptTracingRequest } = require ( '../utils/server' ) ;
7
7
8
- module . exports = async ( { url, argv } ) => {
8
+ module . exports = async ( { url : urlBase , argv } ) => {
9
+ const url = `${ urlBase } /api/http` ;
10
+
9
11
nock ( 'http://example.com' )
10
12
. get ( '/' )
11
13
. reply ( 200 , 'ok' ) ;
@@ -30,13 +32,13 @@ module.exports = async ({ url, argv }) => {
30
32
transaction : 'GET /api/http' ,
31
33
type : 'transaction' ,
32
34
request : {
33
- url : '/api/http' ,
35
+ url,
34
36
} ,
35
37
} ,
36
38
argv ,
37
39
) ;
38
40
39
- await getAsync ( ` ${ url } /api/http` ) ;
41
+ await getAsync ( url ) ;
40
42
await sleep ( 100 ) ;
41
43
42
44
assert . ok ( capturedRequest . isDone ( ) , 'Did not intercept expected request' ) ;
You can’t perform that action at this time.
0 commit comments