@@ -3,7 +3,7 @@ import { RunStep, UseStep } from "./step";
3
3
import { Workflow } from "./workflow" ;
4
4
5
5
describe ( "Workflow" , ( ) => {
6
- it ( "generates a simple workflow" , ( ) => {
6
+ it ( "generates a simple workflow" , async ( ) => {
7
7
const workflow = new Workflow ( "Simple" ) ;
8
8
workflow
9
9
. on ( "pull_request" , { types : [ "opened" ] } )
@@ -15,21 +15,21 @@ describe("Workflow", () => {
15
15
dependsOn : [ "job1" ] ,
16
16
} ) ;
17
17
18
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
18
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
19
19
} ) ;
20
20
21
- it ( "allows multiple events" , ( ) => {
21
+ it ( "allows multiple events" , async ( ) => {
22
22
const workflow = new Workflow ( "Multiple events" ) ;
23
23
workflow
24
24
. on ( "push" , { branches : [ "main" ] } )
25
25
. on ( "pull_request" , { types : [ "opened" ] } )
26
26
. addJob ( "job1" , {
27
27
steps : [ { name : "Do something" , run : "exit 0" } ] ,
28
28
} ) ;
29
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
29
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
30
30
} ) ;
31
31
32
- it ( "allows declaring default options" , ( ) => {
32
+ it ( "allows declaring default options" , async ( ) => {
33
33
const workflow = new Workflow ( "Default options" ) ;
34
34
workflow
35
35
. on ( "push" , { branches : [ "main" ] } )
@@ -39,10 +39,10 @@ describe("Workflow", () => {
39
39
. addJob ( "job1" , {
40
40
steps : [ { name : "Do something" , run : "exit 0" } ] ,
41
41
} ) ;
42
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
42
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
43
43
} ) ;
44
44
45
- it ( "allows declaring environment variables" , ( ) => {
45
+ it ( "allows declaring environment variables" , async ( ) => {
46
46
const workflow = new Workflow ( "With Environment variables" ) ;
47
47
workflow
48
48
. on ( "push" )
@@ -56,10 +56,10 @@ describe("Workflow", () => {
56
56
} ,
57
57
] ,
58
58
} ) ;
59
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
59
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
60
60
} ) ;
61
61
62
- it ( "allows using a concurrency group" , ( ) => {
62
+ it ( "allows using a concurrency group" , async ( ) => {
63
63
const workflow = new Workflow ( "Concurrency group" ) ;
64
64
workflow . on ( "push" ) . addJob ( "job1" , {
65
65
concurrency : {
@@ -72,10 +72,10 @@ describe("Workflow", () => {
72
72
} ,
73
73
] ,
74
74
} ) ;
75
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
75
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
76
76
} ) ;
77
77
78
- it ( "allows using outputs" , ( ) => {
78
+ it ( "allows using outputs" , async ( ) => {
79
79
const workflow = new Workflow ( "Using outputs" ) ;
80
80
workflow . on ( "push" ) . addJob ( "job1" , {
81
81
steps : [
@@ -88,10 +88,10 @@ describe("Workflow", () => {
88
88
"random-number" : "${{ steps.random-number.outputs.random-number }}" ,
89
89
} ,
90
90
} ) ;
91
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
91
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
92
92
} ) ;
93
93
94
- it ( "allows conditional jobs" , ( ) => {
94
+ it ( "allows conditional jobs" , async ( ) => {
95
95
const workflow = new Workflow ( "Conditional job" ) ;
96
96
workflow . on ( "push" ) . addJob ( "job1" , {
97
97
ifExpression : "${{ github.ref != 'refs/heads/main' }}" ,
@@ -101,10 +101,10 @@ describe("Workflow", () => {
101
101
} ,
102
102
] ,
103
103
} ) ;
104
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
104
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
105
105
} ) ;
106
106
107
- it ( "allows a job matrix" , ( ) => {
107
+ it ( "allows a job matrix" , async ( ) => {
108
108
const workflow = new Workflow ( "Conditional job" ) ;
109
109
workflow . on ( "push" ) . addJob ( "job1" , {
110
110
matrix : {
@@ -132,10 +132,10 @@ describe("Workflow", () => {
132
132
} ,
133
133
] ,
134
134
} ) ;
135
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
135
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
136
136
} ) ;
137
137
138
- it ( "allows uses steps" , ( ) => {
138
+ it ( "allows uses steps" , async ( ) => {
139
139
const workflow = new Workflow ( "Uses steps" ) ;
140
140
workflow
141
141
. on ( "push" )
@@ -151,10 +151,10 @@ describe("Workflow", () => {
151
151
} ,
152
152
] ,
153
153
} ) ;
154
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
154
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
155
155
} ) ;
156
156
157
- it ( "allows custom types in a workflow" , ( ) => {
157
+ it ( "allows custom types in a workflow" , async ( ) => {
158
158
interface MyUseStep extends UseStep {
159
159
uses : "custom-action" ;
160
160
with : { foo : string } ;
@@ -163,7 +163,7 @@ describe("Workflow", () => {
163
163
type CustomRunner = "standard-runner" ;
164
164
165
165
const workflow = new Workflow < CustomStep , CustomRunner > (
166
- "With custom types"
166
+ "With custom types" ,
167
167
) ;
168
168
169
169
workflow . on ( "push" ) . addJob ( "job1" , {
@@ -181,10 +181,10 @@ describe("Workflow", () => {
181
181
] ,
182
182
} ) ;
183
183
184
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
184
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
185
185
} ) ;
186
186
187
- it ( "support workflow dispatch event" , ( ) => {
187
+ it ( "support workflow dispatch event" , async ( ) => {
188
188
const workflow = new Workflow ( "Workflow dispatch" ) ;
189
189
workflow
190
190
. on ( "workflow_dispatch" , {
@@ -203,29 +203,29 @@ describe("Workflow", () => {
203
203
. addJob ( "job1" , {
204
204
steps : [ { name : "Do something" , run : "exit 0" } ] ,
205
205
} ) ;
206
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
206
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
207
207
} ) ;
208
208
209
- it ( "supports schedule event" , ( ) => {
209
+ it ( "supports schedule event" , async ( ) => {
210
210
const workflow = new Workflow ( "Schedule" )
211
211
. on ( "schedule" , [ { cron : "0 4 * * 1-5" } ] )
212
212
. addJob ( "job1" , {
213
213
steps : [ { name : "Do something" , run : "exit 0" } ] ,
214
214
} ) ;
215
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
215
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
216
216
} ) ;
217
217
218
- it ( "supports a pretty name for the job" , ( ) => {
218
+ it ( "supports a pretty name for the job" , async ( ) => {
219
219
const workflow = new Workflow ( "Job with pretty name" )
220
220
. on ( "push" )
221
221
. addJob ( "job1" , {
222
222
prettyName : "My pretty name" ,
223
223
steps : [ { name : "Do something" , run : "exit 0" } ] ,
224
224
} ) ;
225
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
225
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
226
226
} ) ;
227
227
228
- it ( "allows permissions into jobs" , ( ) => {
228
+ it ( "allows permissions into jobs" , async ( ) => {
229
229
const workflow = new Workflow ( "Job with permissions" )
230
230
. on ( "push" )
231
231
. addJob ( "job1" , {
@@ -235,10 +235,10 @@ describe("Workflow", () => {
235
235
} ,
236
236
steps : [ { name : "Do something" , run : "exit 0" } ] ,
237
237
} ) ;
238
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
238
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
239
239
} ) ;
240
240
241
- it ( "allows multiline strings" , ( ) => {
241
+ it ( "allows multiline strings" , async ( ) => {
242
242
const workflow = new Workflow ( "Multiline strings" )
243
243
. on ( "push" )
244
244
. addJob ( "job1" , {
@@ -250,10 +250,10 @@ exit 0`,
250
250
} ,
251
251
] ,
252
252
} ) ;
253
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
253
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
254
254
} ) ;
255
255
256
- it ( "allows concurrency groups at workflow level" , ( ) => {
256
+ it ( "allows concurrency groups at workflow level" , async ( ) => {
257
257
const workflow = new Workflow ( "Concurrency at workflow level" )
258
258
. on ( "push" )
259
259
. setConcurrencyGroup ( {
@@ -268,6 +268,6 @@ exit 0`,
268
268
} ,
269
269
] ,
270
270
} ) ;
271
- expect ( workflow . compile ( ) ) . toMatchSnapshot ( ) ;
271
+ expect ( await workflow . compile ( ) ) . toMatchSnapshot ( ) ;
272
272
} ) ;
273
273
} ) ;
0 commit comments