Bocker is a simple mocker for bats.
Install bocker with npm.
npm install -D bocker
See examples for examples.
Load bocker in the test file.
load bocker
Clean up the temporary files used during the test run by adding bock_teardown to the test teardown method.
function teardown() {
bock_teardown
}
Sets up a mock of a call.
arrange [options] call [arguments] -- [does]
Options applied to the mock.
Option | Description |
---|
A list of arguments and/or conditions use to match the call
Matches any remaining arguments.
Matches any argument.
Matches a sequence of arguments in the call.
# usage
has[-sequence count] sequence
# examples
has foo
has-1 foo
has-2 foo bar
What the mocked call will do when executed.
Verifies a mock was run or not.
verify [options] call [arguments]