Skip to content

Commit 88337a3

Browse files
committed
Add parameterized tests for the bail flag
1 parent 73a1fb0 commit 88337a3

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

app.tests.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ describe("Command-line arguments handling", () => {
149149
helpMessage,
150150
],
151151
],
152+
[
153+
["manifest path", "contract name", "seed", "bail"],
154+
["node", "app.js", "example", "counter", "--bail"],
155+
[
156+
red(
157+
`\nInvalid type provided. Please provide the type of test to be executed. Possible values: test, invariant.`
158+
),
159+
helpMessage,
160+
],
161+
],
152162
[
153163
["manifest path", "contract name", "seed"],
154164
["node", "app.js", "example", "counter", "--seed=123"],
@@ -225,6 +235,16 @@ describe("Command-line arguments handling", () => {
225235
`\nStarting invariant testing type for the counter contract...\n`,
226236
],
227237
],
238+
[
239+
["manifest path", "contract name", "type=invariant", "bail"],
240+
["node", "app.js", "example", "counter", "invariant", "--bail"],
241+
[
242+
`Using manifest path: example/Clarinet.toml`,
243+
`Target contract: counter`,
244+
`Bailing on first failure.`,
245+
`\nStarting invariant testing type for the counter contract...\n`,
246+
],
247+
],
228248
[
229249
["manifest path", "contract name", "type=invariant", "dialers file path"],
230250
[
@@ -260,6 +280,16 @@ describe("Command-line arguments handling", () => {
260280
`\nStarting property testing type for the counter contract...\n`,
261281
],
262282
],
283+
[
284+
["manifest path", "contract name", "type=test", "bail"],
285+
["node", "app.js", "example", "counter", "test", "--bail"],
286+
[
287+
`Using manifest path: example/Clarinet.toml`,
288+
`Target contract: counter`,
289+
`Bailing on first failure.`,
290+
`\nStarting property testing type for the counter contract...\n`,
291+
],
292+
],
263293
[
264294
["manifest path", "contract name", "type=invariant", "seed", "path"],
265295
[
@@ -386,6 +416,68 @@ describe("Command-line arguments handling", () => {
386416
`\nStarting property testing type for the counter contract...\n`,
387417
],
388418
],
419+
[
420+
[
421+
"manifest path",
422+
"contract name",
423+
"type=test",
424+
"seed",
425+
"path",
426+
"runs",
427+
"bail",
428+
],
429+
[
430+
"node",
431+
"app.js",
432+
"example",
433+
"counter",
434+
"test",
435+
"--seed=123",
436+
"--path=84:0",
437+
"--runs=10",
438+
"--bail",
439+
],
440+
[
441+
`Using manifest path: example/Clarinet.toml`,
442+
`Target contract: counter`,
443+
`Using seed: 123`,
444+
`Using path: 84:0`,
445+
`Using runs: 10`,
446+
`Bailing on first failure.`,
447+
`\nStarting property testing type for the counter contract...\n`,
448+
],
449+
],
450+
[
451+
[
452+
"manifest path",
453+
"contract name",
454+
"type=invariant",
455+
"seed",
456+
"path",
457+
"runs",
458+
"bail",
459+
],
460+
[
461+
"node",
462+
"app.js",
463+
"example",
464+
"counter",
465+
"invariant",
466+
"--seed=123",
467+
"--path=84:0",
468+
"--runs=10",
469+
"--bail",
470+
],
471+
[
472+
`Using manifest path: example/Clarinet.toml`,
473+
`Target contract: counter`,
474+
`Using seed: 123`,
475+
`Using path: 84:0`,
476+
`Using runs: 10`,
477+
`Bailing on first failure.`,
478+
`\nStarting invariant testing type for the counter contract...\n`,
479+
],
480+
],
389481
])(
390482
"logs the correct values when arguments %p are provided",
391483
async (_testCase: string[], argv: string[], expectedLogs: string[]) => {

0 commit comments

Comments
 (0)