File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+ }
You can’t perform that action at this time.
0 commit comments