You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: __tests__/functions/prechecks.test.js
+160-26
Original file line number
Diff line number
Diff line change
@@ -303,7 +303,9 @@ test('runs prechecks and finds that the IssueOps command is valid for a branch d
303
303
isFork: false
304
304
})
305
305
306
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: markdown-lint')
306
+
expect(debugMock).toHaveBeenCalledWith(
307
+
'filterChecks() - ignoring ci check: markdown-lint'
308
+
)
307
309
})
308
310
309
311
test('runs prechecks and finds that the IssueOps command is valid for a branch deployment with a few explictly requested checks and a few ignored checks',async()=>{
@@ -375,13 +377,113 @@ test('runs prechecks and finds that the IssueOps command is valid for a branch d
375
377
isFork: false
376
378
})
377
379
378
-
expect(debugMock).toHaveBeenCalledWith('explicitly including ci check: test')
379
380
expect(debugMock).toHaveBeenCalledWith(
380
-
'explicitly including ci check: acceptance-test'
381
+
'filterChecks() - explicitly including ci check: test'
382
+
)
383
+
expect(debugMock).toHaveBeenCalledWith(
384
+
'filterChecks() - explicitly including ci check: acceptance-test'
385
+
)
386
+
expect(debugMock).toHaveBeenCalledWith(
387
+
'filterChecks() - explicitly including ci check: lint'
388
+
)
389
+
expect(debugMock).toHaveBeenCalledWith(
390
+
'filterChecks() - markdown-lint is not in the explicit list of checks to include (test,acceptance-test,lint)'
391
+
)
392
+
expect(debugMock).not.toHaveBeenCalledWith(
393
+
'filterChecks() - ignoring ci check: markdown-lint'
394
+
)
395
+
expect(debugMock).toHaveBeenCalledWith(
396
+
'filterChecks() - ignoring ci check: lint'
397
+
)
398
+
})
399
+
400
+
test('runs prechecks and finds that the IssueOps command is valid for a branch deployment with a few explictly requested checks and a few ignored checks but one CI check is missing',async()=>{
'### ⚠️ Cannot proceed with deployment\n\n- reviewDecision: `APPROVED`\n- commitStatus: `MISSING`\n\n> The `checks` input option requires that all of the following checks are passing: `test,acceptance-test,quality-control,lint`. However, the following checks are missing: `quality-control`',
463
+
status: false
464
+
})
465
+
466
+
expect(warningMock).toHaveBeenCalledWith(
467
+
`the ${COLORS.info}checks${COLORS.reset} input option requires that all of the following checks are passing: ${COLORS.highlight}${data.inputs.checks.join(', ')}${COLORS.reset} - however, the following checks are missing: ${COLORS.highlight}quality-control${COLORS.reset}`
468
+
)
469
+
expect(debugMock).not.toHaveBeenCalledWith(
470
+
'filterChecks() - explicitly including ci check: test'
471
+
)
472
+
expect(debugMock).not.toHaveBeenCalledWith(
473
+
'filterChecks() - explicitly including ci check: acceptance-test'
474
+
)
475
+
expect(debugMock).not.toHaveBeenCalledWith(
476
+
'filterChecks() - explicitly including ci check: lint'
477
+
)
478
+
expect(debugMock).not.toHaveBeenCalledWith(
479
+
'filterChecks() - markdown-lint is not in the explicit list of checks to include (test,acceptance-test,lint)'
480
+
)
481
+
expect(debugMock).not.toHaveBeenCalledWith(
482
+
'filterChecks() - ignoring ci check: markdown-lint'
483
+
)
484
+
expect(debugMock).not.toHaveBeenCalledWith(
485
+
'filterChecks() - ignoring ci check: lint'
381
486
)
382
-
expect(debugMock).toHaveBeenCalledWith('explicitly including ci check: lint')
383
-
expect(debugMock).not.toHaveBeenCalledWith('ignoring ci check: markdown-lint')
384
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: lint')
385
487
})
386
488
387
489
test('runs prechecks and finds that the IssueOps command is valid for a branch deployment but checks and ignore checks cancel eachother out',async()=>{
@@ -465,22 +567,38 @@ test('runs prechecks and finds that the IssueOps command is valid for a branch d
465
567
isFork: false
466
568
})
467
569
468
-
expect(debugMock).toHaveBeenCalledWith('explicitly including ci check: test')
469
570
expect(debugMock).toHaveBeenCalledWith(
470
-
'explicitly including ci check: acceptance-test'
571
+
'filterChecks() - explicitly including ci check: test'
572
+
)
573
+
expect(debugMock).toHaveBeenCalledWith(
574
+
'filterChecks() - explicitly including ci check: acceptance-test'
471
575
)
472
-
expect(debugMock).toHaveBeenCalledWith('explicitly including ci check: lint')
473
576
expect(debugMock).toHaveBeenCalledWith(
474
-
'explicitly including ci check: markdown-lint'
475
-
)
476
-
expect(debugMock).toHaveBeenCalledWith('explicitly including ci check: build')
477
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: markdown-lint')
478
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: lint')
479
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: build')
480
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: test')
481
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: acceptance-test')
577
+
'filterChecks() - explicitly including ci check: lint'
578
+
)
579
+
expect(debugMock).toHaveBeenCalledWith(
580
+
'filterChecks() - explicitly including ci check: markdown-lint'
581
+
)
582
+
expect(debugMock).toHaveBeenCalledWith(
583
+
'filterChecks() - explicitly including ci check: build'
584
+
)
585
+
expect(debugMock).toHaveBeenCalledWith(
586
+
'filterChecks() - ignoring ci check: markdown-lint'
587
+
)
588
+
expect(debugMock).toHaveBeenCalledWith(
589
+
'filterChecks() - ignoring ci check: lint'
590
+
)
591
+
expect(debugMock).toHaveBeenCalledWith(
592
+
'filterChecks() - ignoring ci check: build'
593
+
)
594
+
expect(debugMock).toHaveBeenCalledWith(
595
+
'filterChecks() - ignoring ci check: test'
596
+
)
597
+
expect(debugMock).toHaveBeenCalledWith(
598
+
'filterChecks() - ignoring ci check: acceptance-test'
599
+
)
482
600
expect(debugMock).toHaveBeenCalledWith(
483
-
'after filtering, no checks remain - this will result in a SUCCESS state as it is treated as if no checks are defined'
601
+
'filterChecks() - after filtering, no checks remain - this will result in a SUCCESS state as it is treated as if no checks are defined'
484
602
)
485
603
})
486
604
@@ -553,8 +671,12 @@ test('runs prechecks and finds that the IssueOps command is valid for a branch d
553
671
isFork: false
554
672
})
555
673
556
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: build')
557
-
expect(debugMock).toHaveBeenCalledWith('ignoring ci check: markdown-lint')
674
+
expect(debugMock).toHaveBeenCalledWith(
675
+
'filterChecks() - ignoring ci check: build'
676
+
)
677
+
expect(debugMock).toHaveBeenCalledWith(
678
+
'filterChecks() - ignoring ci check: markdown-lint'
679
+
)
558
680
})
559
681
560
682
test('runs prechecks and finds that the IssueOps command is valid for a branch deployment with ALL checks being required but the user has provided some checks to ignore',async()=>{
@@ -626,8 +748,12 @@ test('runs prechecks and finds that the IssueOps command is valid for a branch d
626
748
expect(debugMock).not.toHaveBeenCalledWith(
627
749
'explicitly including ci check: test'
628
750
)
629
-
expect(debugMock).not.toHaveBeenCalledWith('ignoring ci check: build')
630
-
expect(debugMock).not.toHaveBeenCalledWith('ignoring ci check: markdown-lint')
751
+
expect(debugMock).not.toHaveBeenCalledWith(
752
+
'filterChecks() - ignoring ci check: build'
753
+
)
754
+
expect(debugMock).not.toHaveBeenCalledWith(
755
+
'filterChecks() - ignoring ci check: markdown-lint'
756
+
)
631
757
})
632
758
633
759
test('runs prechecks and finds that the IssueOps command is valid for a branch deployment with ALL checks being required but the user has provided some checks to ignore but none match',async()=>{
@@ -696,8 +822,12 @@ test('runs prechecks and finds that the IssueOps command is valid for a branch d
696
822
status: false
697
823
})
698
824
699
-
expect(debugMock).not.toHaveBeenCalledWith('ignoring ci check: build')
700
-
expect(debugMock).not.toHaveBeenCalledWith('ignoring ci check: markdown-lint')
825
+
expect(debugMock).not.toHaveBeenCalledWith(
826
+
'filterChecks() - ignoring ci check: build'
827
+
)
828
+
expect(debugMock).not.toHaveBeenCalledWith(
829
+
'filterChecks() - ignoring ci check: markdown-lint'
830
+
)
701
831
})
702
832
703
833
test('runs prechecks and finds that the IssueOps command is valid for a branch deployment with ALL checks being required and the user did not provided checks to ignore and some are failing',async()=>{
@@ -766,8 +896,12 @@ test('runs prechecks and finds that the IssueOps command is valid for a branch d
766
896
status: false
767
897
})
768
898
769
-
expect(debugMock).not.toHaveBeenCalledWith('ignoring ci check: build')
770
-
expect(debugMock).not.toHaveBeenCalledWith('ignoring ci check: markdown-lint')
899
+
expect(debugMock).not.toHaveBeenCalledWith(
900
+
'filterChecks() - ignoring ci check: build'
901
+
)
902
+
expect(debugMock).not.toHaveBeenCalledWith(
903
+
'filterChecks() - ignoring ci check: markdown-lint'
904
+
)
771
905
})
772
906
773
907
test('runs prechecks and finds that the IssueOps command is valid for a rollback deployment',async()=>{
0 commit comments