@@ -56,12 +56,6 @@ describe('onPostBuild', () => {
56
56
expect ( serveFolder ) . not . toHaveBeenCalled ( )
57
57
} )
58
58
59
- describe ( 'recording' , ( ) => {
60
- it . todo ( 'records the test run when enabled and record key is specified' )
61
- it . todo ( 'does not record the test run when record key is missing' )
62
- it . todo ( 'does not record when recording is disabled' )
63
- } )
64
-
65
59
describe ( 'start option' , ( ) => {
66
60
it ( 'runs the specified command' , async ( ) => {
67
61
const startCommand = 'a start command'
@@ -233,8 +227,44 @@ describe('onPostBuild', () => {
233
227
await expect ( testFunction ( ) ) . rejects . toBe ( error )
234
228
} )
235
229
236
- it . todo ( 'runs the cypress tests' )
230
+ it ( 'runs the cypress tests' , async ( ) => {
231
+ const { testFunction, inputs } = setup ( {
232
+ postBuildInputs : {
233
+ enable : true ,
234
+ } ,
235
+ } )
236
+
237
+ await expect ( testFunction ( ) ) . resolves . toBe ( undefined )
238
+ // TODO: Improve this assertion
239
+ expect ( runCypressTests ) . toHaveBeenCalledWith (
240
+ 'http://localhost:8080' ,
241
+ inputs . postBuild . record ,
242
+ inputs . postBuild . spec ,
243
+ undefined ,
244
+ undefined ,
245
+ 'chromium' ,
246
+ undefined ,
247
+ )
248
+ } )
249
+
250
+ it ( 'processes the cypress test results' , async ( ) => {
251
+ const { testFunction, inputs, utils } = setup ( {
252
+ postBuildInputs : {
253
+ enable : true ,
254
+ start : 'a start command' ,
255
+ } ,
256
+ } )
257
+
258
+ const testResults = 'RESULTS'
259
+ runCypressTests . mockReturnValue ( testResults )
237
260
238
- it . todo ( 'processes the cypress test results' )
261
+ await expect ( testFunction ( ) ) . resolves . toBe ( undefined )
262
+ // TODO: Improve assertion
263
+ expect ( processCypressResults ) . toHaveBeenCalledWith (
264
+ testResults ,
265
+ expect . any ( Function ) ,
266
+ expect . any ( Function ) ,
267
+ )
268
+ } )
239
269
} )
240
270
} )
0 commit comments