-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.bats
62 lines (56 loc) · 1.39 KB
/
cli.bats
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bats
setup() {
declare desc="some tasks executed before every unit test"
}
@test "single-line" {
cat fixtures/single-line.txt | {
run ./cli.js
[ "$status" -eq 0 ]
[ "${lines[0]}" = "debug-one" ]
[ "${#lines[@]}" = "1" ]
}
}
@test "single-log" {
cat fixtures/single-log.txt | {
run ./cli.js
[ "$status" -eq 0 ]
[ "${lines[0]}" = "debug-one" ]
[ "${#lines[@]}" = "1" ]
}
}
@test "one-digit-milliseconds" {
cat fixtures/one-digit-milliseconds.txt | {
run ./cli.js
[ "$status" -eq 0 ]
[ "${lines[0]}" = "debug-one" ]
[ "${lines[1]}" = "debug-two" ]
[ "${lines[2]}" = "debug-three" ]
[ "${#lines[@]}" = "3" ]
}
}
@test "multiple-logs-multiple-lines" {
cat fixtures/multiple-logs-multiple-lines.txt | {
run ./cli.js
[ "$status" -eq 0 ]
[ "${lines[0]}" = "debug-one" ]
[ "${lines[1]}" = "debug-two" ]
[ "${lines[2]}" = "debug-three" ]
[ "${lines[3]}" = "debug-four" ]
[ "${#lines[@]}" = "4" ]
}
}
@test "full" {
cat fixtures/full.txt | {
run ./cli.js
[ "$status" -eq 0 ]
[ "${lines[0]}" = "debug-one" ]
[ "${lines[1]}" = "debug-two" ]
[ "${lines[2]}" = "debug-three" ]
[ "${lines[3]}" = "debug-four" ]
[ "${lines[4]}" = "info-one" ]
[ "${lines[5]}" = "info-two" ]
[ "${lines[6]}" = "debug-one" ]
[ "${lines[7]}" = "debug-two" ]
[ "${#lines[@]}" = "8" ]
}
}