Skip to content

Transpiria/bocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bocker

CircleCI NPM

Bocker is a simple mocker for bats.

Installation

Npm

Install bocker with npm.

npm install -D bocker

Usage

See examples for examples.

Setup

Load bocker in the test file.

load bocker

Cleanup

Clean up the temporary files used during the test run by adding bock_teardown to the test teardown method.

function teardown() {
    bock_teardown
}

Arrange

Sets up a mock of a call.

arrange [options] call [arguments] -- [does]

Options

Options applied to the mock.

Option Description

Arguments

A list of arguments and/or conditions use to match the call

anyargs

Matches any remaining arguments.

any

Matches any argument.

has

Matches a sequence of arguments in the call.

# usage
has[-sequence count] sequence

# examples
has foo
has-1 foo
has-2 foo bar

Does

What the mocked call will do when executed.

Verify

Verifies a mock was run or not.

verify [options] call [arguments]