3
3
# Functional tests for init.sh.
4
4
#
5
5
# Example usage:
6
- # ./tests/ scaffold/node_modules/.bin/bats --no-tempdir-cleanup --formatter tap --filter-tags smoke tests/ scaffold
6
+ # ./. scaffold/tests/ node_modules/.bin/bats --no-tempdir-cleanup --formatter tap --filter-tags smoke . scaffold/tests
7
7
#
8
8
# shellcheck disable=SC2030,SC2031,SC2129
9
9
@@ -14,7 +14,7 @@ export BATS_FIXTURE_EXPORT_CODEBASE_ENABLED=1
14
14
export SCRIPT_FILE=" init.sh"
15
15
16
16
# bats test_tags=smoke
17
- @test " Init, defaults" {
17
+ @test " Init, defaults, workflow " {
18
18
answers=(
19
19
" YodasHut" # organisation
20
20
" force_crystal" # project
@@ -35,11 +35,13 @@ export SCRIPT_FILE="init.sh"
35
35
assert_output_contains " Please follow the prompts to adjust your extension configuration"
36
36
assert_files_present_common " ${BUILD_DIR} "
37
37
assert_files_present_extension_type_module " ${BUILD_DIR} "
38
+ assert_output_contains " Initialization complete."
39
+
38
40
assert_workflow " ${BUILD_DIR} "
39
41
}
40
42
41
43
# bats test_tags=smoke
42
- @test " Init, theme" {
44
+ @test " Init, extension theme, workflow " {
43
45
answers=(
44
46
" YodasHut" # organisation
45
47
" force_crystal" # project
@@ -60,5 +62,199 @@ export SCRIPT_FILE="init.sh"
60
62
assert_output_contains " Please follow the prompts to adjust your extension configuration"
61
63
assert_files_present_common " ${BUILD_DIR} "
62
64
assert_files_present_extension_type_theme " ${BUILD_DIR} "
65
+ assert_output_contains " Initialization complete."
66
+
67
+ assert_workflow " ${BUILD_DIR} "
68
+ }
69
+
70
+ # bats test_tags=smoke
71
+ @test " Init, no release drafter, workflow" {
72
+ answers=(
73
+ " YodasHut" # organisation
74
+ " force_crystal" # project
75
+ " Force Crystal" # name
76
+ " module" # type
77
+ " Jane Doe" # author
78
+ " nothing" # use NodeJS
79
+ " n" # use GitHub release drafter
80
+ " nothing" # use GitHub pr auto-assign
81
+ " nothing" # use GitHub funding
82
+ " nothing" # use GitHub PR template
83
+ " nothing" # use Renovate
84
+ " nothing" # remove init script
85
+ " nothing" # proceed with init
86
+ )
87
+ tui_run " ${answers[@]} "
88
+
89
+ assert_output_contains " Please follow the prompts to adjust your extension configuration"
90
+ assert_files_present_common " ${BUILD_DIR} "
91
+ assert_files_present_extension_type_module " ${BUILD_DIR} "
92
+ assert_file_not_exists " .github/workflows/draft-release-notes.yml"
93
+ assert_file_not_exists " .github/release-drafter.yml"
94
+ assert_output_contains " Initialization complete."
95
+
96
+ assert_workflow " ${BUILD_DIR} "
97
+ }
98
+
99
+ # bats test_tags=smoke
100
+ @test " Init, no PR auto-assign, workflow" {
101
+ answers=(
102
+ " YodasHut" # organisation
103
+ " force_crystal" # project
104
+ " Force Crystal" # name
105
+ " module" # type
106
+ " Jane Doe" # author
107
+ " nothing" # use NodeJS
108
+ " nothing" # use GitHub release drafter
109
+ " n" # use GitHub pr auto-assign
110
+ " nothing" # use GitHub funding
111
+ " nothing" # use GitHub PR template
112
+ " nothing" # use Renovate
113
+ " nothing" # remove init script
114
+ " nothing" # proceed with init
115
+ )
116
+ tui_run " ${answers[@]} "
117
+
118
+ assert_output_contains " Please follow the prompts to adjust your extension configuration"
119
+ assert_files_present_common " ${BUILD_DIR} "
120
+ assert_files_present_extension_type_module " ${BUILD_DIR} "
121
+ assert_file_not_exists " .github/assign-author.yml"
122
+ assert_output_contains " Initialization complete."
123
+
124
+ assert_workflow " ${BUILD_DIR} "
125
+ }
126
+
127
+ @test " Init, no funding, workflow" {
128
+ answers=(
129
+ " YodasHut" # organisation
130
+ " force_crystal" # project
131
+ " Force Crystal" # name
132
+ " module" # type
133
+ " Jane Doe" # author
134
+ " nothing" # use NodeJS
135
+ " nothing" # use GitHub release drafter
136
+ " nothing" # use GitHub pr auto-assign
137
+ " n" # use GitHub funding
138
+ " nothing" # use GitHub PR template
139
+ " nothing" # use Renovate
140
+ " nothing" # remove init script
141
+ " nothing" # proceed with init
142
+ )
143
+ tui_run " ${answers[@]} "
144
+
145
+ assert_output_contains " Please follow the prompts to adjust your extension configuration"
146
+ assert_files_present_common " ${BUILD_DIR} "
147
+ assert_files_present_extension_type_module " ${BUILD_DIR} "
148
+ assert_file_not_exists " .github/FUNDING.yml"
149
+ assert_output_contains " Initialization complete."
150
+
151
+ assert_workflow " ${BUILD_DIR} "
152
+ }
153
+
154
+ @test " Init, no PR template, workflow" {
155
+ answers=(
156
+ " YodasHut" # organisation
157
+ " force_crystal" # project
158
+ " Force Crystal" # name
159
+ " module" # type
160
+ " Jane Doe" # author
161
+ " nothing" # use NodeJS
162
+ " nothing" # use GitHub release drafter
163
+ " nothing" # use GitHub pr auto-assign
164
+ " nothing" # use GitHub funding
165
+ " n" # use GitHub PR template
166
+ " nothing" # use Renovate
167
+ " nothing" # remove init script
168
+ " nothing" # proceed with init
169
+ )
170
+ tui_run " ${answers[@]} "
171
+
172
+ assert_output_contains " Please follow the prompts to adjust your extension configuration"
173
+ assert_files_present_common " ${BUILD_DIR} "
174
+ assert_files_present_extension_type_module " ${BUILD_DIR} "
175
+ assert_file_not_exists " .github/PULL_REQUEST_TEMPLATE.md"
176
+ assert_output_contains " Initialization complete."
177
+
178
+ assert_workflow " ${BUILD_DIR} "
179
+ }
180
+
181
+ @test " Init, no Renovate, workflow" {
182
+ answers=(
183
+ " YodasHut" # organisation
184
+ " force_crystal" # project
185
+ " Force Crystal" # name
186
+ " module" # type
187
+ " Jane Doe" # author
188
+ " nothing" # use NodeJS
189
+ " nothing" # use GitHub release drafter
190
+ " nothing" # use GitHub pr auto-assign
191
+ " nothing" # use GitHub funding
192
+ " nothing" # use GitHub PR template
193
+ " n" # use Renovate
194
+ " nothing" # remove init script
195
+ " nothing" # proceed with init
196
+ )
197
+ tui_run " ${answers[@]} "
198
+
199
+ assert_output_contains " Please follow the prompts to adjust your extension configuration"
200
+ assert_files_present_common " ${BUILD_DIR} "
201
+ assert_files_present_extension_type_module " ${BUILD_DIR} "
202
+ assert_file_not_exists " renovate.json"
203
+ assert_output_contains " Initialization complete."
204
+
205
+ assert_workflow " ${BUILD_DIR} "
206
+ }
207
+
208
+ @test " Init, do not remove script, workflow" {
209
+ answers=(
210
+ " YodasHut" # organisation
211
+ " force_crystal" # project
212
+ " Force Crystal" # name
213
+ " module" # type
214
+ " Jane Doe" # author
215
+ " nothing" # use NodeJS
216
+ " nothing" # use GitHub release drafter
217
+ " nothing" # use GitHub pr auto-assign
218
+ " nothing" # use GitHub funding
219
+ " nothing" # use GitHub PR template
220
+ " nothing" # use Renovate
221
+ " n" # remove init script
222
+ " nothing" # proceed with init
223
+ )
224
+ tui_run " ${answers[@]} "
225
+
226
+ assert_output_contains " Please follow the prompts to adjust your extension configuration"
227
+ assert_files_present_common " ${BUILD_DIR} "
228
+ assert_files_present_extension_type_module " ${BUILD_DIR} "
229
+ assert_file_exists " init.sh"
230
+ assert_output_contains " Initialization complete."
231
+
63
232
assert_workflow " ${BUILD_DIR} "
64
233
}
234
+
235
+ @test " Init, remove script, workflow" {
236
+ answers=(
237
+ " YodasHut" # organisation
238
+ " force_crystal" # project
239
+ " Force Crystal" # name
240
+ " module" # type
241
+ " Jane Doe" # author
242
+ " nothing" # use NodeJS
243
+ " nothing" # use GitHub release drafter
244
+ " nothing" # use GitHub pr auto-assign
245
+ " nothing" # use GitHub funding
246
+ " nothing" # use GitHub PR template
247
+ " nothing" # use Renovate
248
+ " y" # remove init script
249
+ " nothing" # proceed with init
250
+ )
251
+ tui_run " ${answers[@]} "
252
+
253
+ assert_output_contains " Please follow the prompts to adjust your extension configuration"
254
+ assert_files_present_common " ${BUILD_DIR} "
255
+ assert_files_present_extension_type_module " ${BUILD_DIR} "
256
+ assert_file_not_exists " init.sh"
257
+ assert_output_contains " Initialization complete."
258
+
259
+ # assert_workflow "${BUILD_DIR}"
260
+ }
0 commit comments