@@ -4,11 +4,10 @@ const { URL } = require("url");
4
4
const path = require ( "node:path" ) ;
5
5
6
6
const {
7
- executeOK,
8
- logOnFail,
9
- } = require ( 'gqltest/packages/gqltest/gqltest.js' )
7
+ runtests,
8
+ } = require ( 'gqltest/packages/gqltest/gqltest.js' ) ;
10
9
11
- const stepzen = require ( ' gqltest/packages/gqltest/stepzen.js' ) ;
10
+ const stepzen = require ( " gqltest/packages/gqltest/stepzen.js" ) ;
12
11
13
12
const endpoint = process . env . STEPZEN_ENDPOINT ;
14
13
@@ -31,58 +30,23 @@ function deployEndpoint(endpoint, dirname) {
31
30
console . log ( stdout ) ;
32
31
}
33
32
34
- // Runs a GraphQL request against the endpoint
35
- // as a test returning the response.
36
- // The test will fail if the request does not
37
- // have status 200 or has any GraphQL errors.
38
- async function runGqlOk ( endpoint , headers , request , expected ) {
39
- await executeOK ( {
40
- test : this ,
41
- endpoint,
42
- headers : headers ,
43
- request,
44
- expected,
45
- } )
46
- }
47
-
48
33
// deploys graphql schema located in dirname to the test endpoint provided by the environment (process.env.STEPZEN_ENDPOINT),
49
34
// and then runs through all fo the field selection tests.
50
35
function deployAndRun ( dirname , tests , headers ) {
51
- it ( "deploy" , function ( ) {
52
- // deployEndpoint will try up to three times to deploy
53
- // the schema with a backoff that can total four seconds.
54
- // So set the timeout to be (3*10)+4 seconds to cover a worst case scenario.
55
- this . timeout ( 34000 ) ;
56
- return deployEndpoint ( endpoint , dirname ) ;
36
+ describe ( "deployAndRun" , function ( ) {
37
+ this . timeout ( 10000 ) ;
38
+ this . slow ( 1000 ) ;
39
+ it ( "deploy" , function ( ) {
40
+ // deployEndpoint will try up to three times to deploy
41
+ // the schema with a backoff that can total four seconds.
42
+ // So set the timeout to be (3*10)+4 seconds to cover a worst case scenario.
43
+ this . timeout ( 34000 ) ;
44
+ this . slow ( 5000 ) ;
45
+ return deployEndpoint ( endpoint , dirname ) ;
46
+ } ) ;
47
+
48
+ runtests ( "run" , endpoint , headers , tests ) ;
57
49
} ) ;
58
-
59
- afterEach ( 'log-failure' , logOnFail )
60
- tests . forEach (
61
- ( { label, documentId, query, variables, operationName, expected, authType } ) => {
62
- it ( label , async function ( ) {
63
- this . timeout ( 4000 ) ; // Occasional requests take > 2s
64
- let request = { }
65
- if ( query ) {
66
- request . query = query ;
67
- }
68
- if ( documentId ) {
69
- request . documentId = documentId ;
70
- }
71
- if ( operationName ) {
72
- request . operationName = operationName ;
73
- }
74
- if ( variables ) {
75
- request . variables = variables ;
76
- }
77
- return await runGqlOk (
78
- endpoint ,
79
- headers ,
80
- request ,
81
- expected ,
82
- ) ;
83
- } ) ;
84
- }
85
- ) ;
86
50
}
87
51
88
52
function getTestDescription ( testRoot , fullDirName ) {
@@ -96,4 +60,4 @@ function getTestDescription(testRoot, fullDirName) {
96
60
exports . deployAndRun = deployAndRun ;
97
61
exports . getTestDescription = getTestDescription ;
98
62
99
- exports . stepzen = stepzen
63
+ exports . stepzen = stepzen ;
0 commit comments