Skip to content

Instantly share code, notes, and snippets.

@janhesters
Created September 26, 2020 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janhesters/86c1255c8f2ba4990b33dca26ed686c3 to your computer and use it in GitHub Desktop.
Save janhesters/86c1255c8f2ba4990b33dca26ed686c3 to your computer and use it in GitHub Desktop.
Tests for the mock fuction.
import { describe } from 'riteway';
import fn from './mock-fn.js';
describe('fn - the mock function', async assert => {
const mockedFn = fn((a, b) => a + b);
assert({
given: 'calling a mocked function',
should: 'should return the correct result',
actual: mockedFn(21, 21),
expected: 42,
});
assert({
given: "a mocked function's calls",
should: 'return the correct args',
actual: mockedFn.calls,
expected: [[21, 21]],
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment