-
Notifications
You must be signed in to change notification settings - Fork 18
/
cli_test.ts
47 lines (38 loc) · 1.43 KB
/
cli_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { assertEquals } from "https://deno.land/std@0.112.0/testing/asserts.ts";
import { main } from "./cli.ts";
Deno.test("cli.ts -h, --help -- returns 0", async () => {
assertEquals(await main(["--help"]), 0);
assertEquals(await main(["-h"]), 0);
});
Deno.test("cli.ts -v, --version -- returns 0", async () => {
assertEquals(await main(["--version"]), 0);
assertEquals(await main(["-v"]), 0);
});
Deno.test("cli.ts help -- returns 0", async () => {
// This is error because no entrypoint is given
assertEquals(await main(["help"]), 0);
});
Deno.test("cli.ts help build -- returns 0", async () => {
// This is error because no entrypoint is given
assertEquals(await main(["help", "build"]), 0);
});
Deno.test("cli.ts help serve -- returns 0", async () => {
// This is error because no entrypoint is given
assertEquals(await main(["help", "serve"]), 0);
});
Deno.test("cli.ts help bar -- returns 1", async () => {
// This is error because no entrypoint is given
assertEquals(await main(["help", "bar"]), 1);
});
Deno.test("cli.ts build -- returns 1", async () => {
// build subcommand with no entrypoint
assertEquals(await main(["build"]), 1);
});
Deno.test("cli.ts serve -- returns 1", async () => {
// serve subcommand with no entrypoint
assertEquals(await main(["serve"]), 1);
});
Deno.test("cli.ts -- returns 1", async () => {
// This is error because no entrypoint is given
assertEquals(await main([]), 1);
});