@@ -19,6 +19,93 @@ describe("setStatusImpl", () => {
19
19
await expect ( setStatusImpl ( { } ) ) . rejects . toThrow ( ) ;
20
20
} ) ;
21
21
22
+ it ( "throws when issue_number is null" , async ( ) => {
23
+ await expect (
24
+ setStatusImpl ( {
25
+ owner : "test-owner" ,
26
+ repo : "test-repo" ,
27
+ head_sha : "test-head-sha" ,
28
+ // @ts -expect-error - Testing invalid input
29
+ issue_number : null ,
30
+ target_url : "https://test.com/set_status_url" ,
31
+ github,
32
+ core,
33
+ monitoredWorkflowName : "test-workflow" ,
34
+ requiredStatusName : "test-status" ,
35
+ overridingLabel : "test-label" ,
36
+ } ) ,
37
+ ) . rejects . toThrow ( "issue_number must be a positive integer" ) ;
38
+ } ) ;
39
+
40
+ it ( "throws when issue_number is undefined" , async ( ) => {
41
+ await expect (
42
+ setStatusImpl ( {
43
+ owner : "test-owner" ,
44
+ repo : "test-repo" ,
45
+ head_sha : "test-head-sha" ,
46
+ // @ts -expect-error - Testing invalid input
47
+ issue_number : undefined ,
48
+ target_url : "https://test.com/set_status_url" ,
49
+ github,
50
+ core,
51
+ monitoredWorkflowName : "test-workflow" ,
52
+ requiredStatusName : "test-status" ,
53
+ overridingLabel : "test-label" ,
54
+ } ) ,
55
+ ) . rejects . toThrow ( "issue_number must be a positive integer" ) ;
56
+ } ) ;
57
+
58
+ it ( "throws when issue_number is NaN" , async ( ) => {
59
+ await expect (
60
+ setStatusImpl ( {
61
+ owner : "test-owner" ,
62
+ repo : "test-repo" ,
63
+ head_sha : "test-head-sha" ,
64
+ issue_number : NaN ,
65
+ target_url : "https://test.com/set_status_url" ,
66
+ github,
67
+ core,
68
+ monitoredWorkflowName : "test-workflow" ,
69
+ requiredStatusName : "test-status" ,
70
+ overridingLabel : "test-label" ,
71
+ } ) ,
72
+ ) . rejects . toThrow ( "issue_number must be a positive integer" ) ;
73
+ } ) ;
74
+
75
+ it ( "throws when issue_number is zero" , async ( ) => {
76
+ await expect (
77
+ setStatusImpl ( {
78
+ owner : "test-owner" ,
79
+ repo : "test-repo" ,
80
+ head_sha : "test-head-sha" ,
81
+ issue_number : 0 ,
82
+ target_url : "https://test.com/set_status_url" ,
83
+ github,
84
+ core,
85
+ monitoredWorkflowName : "test-workflow" ,
86
+ requiredStatusName : "test-status" ,
87
+ overridingLabel : "test-label" ,
88
+ } ) ,
89
+ ) . rejects . toThrow ( "issue_number must be a positive integer" ) ;
90
+ } ) ;
91
+
92
+ it ( "throws when issue_number is negative" , async ( ) => {
93
+ await expect (
94
+ setStatusImpl ( {
95
+ owner : "test-owner" ,
96
+ repo : "test-repo" ,
97
+ head_sha : "test-head-sha" ,
98
+ issue_number : - 1 ,
99
+ target_url : "https://test.com/set_status_url" ,
100
+ github,
101
+ core,
102
+ monitoredWorkflowName : "test-workflow" ,
103
+ requiredStatusName : "test-status" ,
104
+ overridingLabel : "test-label" ,
105
+ } ) ,
106
+ ) . rejects . toThrow ( "issue_number must be a positive integer" ) ;
107
+ } ) ;
108
+
22
109
it ( "sets success if approved by label" , async ( ) => {
23
110
github . rest . issues . listLabelsOnIssue . mockResolvedValue ( {
24
111
data : [ { name : "test" } , { name : "Approved-Avocado" } ] ,
0 commit comments