Skip to content

Commit 378b48d

Browse files
add non-working spy functional tests
1 parent 29225b5 commit 378b48d

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

tests/functional/doubles_test.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,53 @@ function test_mock_ps_when_executing_a_sourced_function() {
1212

1313
assert_match_snapshot "$(top_mem)"
1414
}
15+
16+
function test_spy_commands_called_when_executing_a_script() {
17+
spy ps
18+
spy awk
19+
spy head
20+
21+
./tests/functional/fixtures/doubles_script.sh
22+
23+
assert_have_been_called ps
24+
assert_have_been_called awk
25+
assert_have_been_called head
26+
}
27+
28+
function test_spy_commands_called_when_executing_a_sourced_function() {
29+
source ./tests/functional/fixtures/doubles_function.sh
30+
spy ps
31+
spy awk
32+
spy head
33+
34+
top_mem
35+
36+
assert_have_been_called ps
37+
assert_have_been_called awk
38+
assert_have_been_called head
39+
}
40+
41+
function test_spy_commands_called_once_when_executing_a_script() {
42+
spy ps
43+
spy awk
44+
spy head
45+
46+
./tests/functional/fixtures/doubles_script.sh
47+
48+
assert_have_been_called_times 1 ps
49+
assert_have_been_called_times 1 awk
50+
assert_have_been_called_times 1 head
51+
}
52+
53+
function test_spy_commands_called_once_when_executing_a_sourced_function() {
54+
source ./tests/functional/fixtures/doubles_function.sh
55+
spy ps
56+
spy awk
57+
spy head
58+
59+
top_mem
60+
61+
assert_have_been_called_times 1 ps
62+
assert_have_been_called_times 1 awk
63+
assert_have_been_called_times 1 head
64+
}

0 commit comments

Comments
 (0)