-
Notifications
You must be signed in to change notification settings - Fork 534
/
sanity_spec.sh
54 lines (47 loc) · 1.28 KB
/
sanity_spec.sh
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
#shellcheck shell=sh
: '
Since we are dealing with multiple utilities and environments
we should have a sanity test in place to test them
'
Describe "Snyk CLI"
It "have Snyk CLI available"
When run which snyk
The output should include "/snyk"
The status should be success
The stderr should equal ""
End
End
Describe "sanity checks for tooling"
Describe "timeout"
It "have timeout available"
When run which timeout
The output should include "/timeout"
The status should be success
The stderr should equal ""
End
End
Describe "jq"
It "have jq available"
When run which jq
The output should include "/jq"
The status should be success
The stderr should equal ""
End
It "validates JSON"
When run echo '{"k": [1,2]}'
The result of function check_valid_json should be success
End
It "validates JSON when called as When-function"
When run check_valid_json '{"k": [1,2]}'
The status should be success
The stdout should equal 0
The stderr should equal ""
End
# Only way to capture parse error
It "fails on invalid JSON"
When run check_valid_json '{"k": [1,2'
The status should be failure
The stderr should include "parse error"
End
End
End