Skip to content

Instantly share code, notes, and snippets.

@shallwefootball
Created February 10, 2017 05:43
Show Gist options
  • Save shallwefootball/89e9b9a111ceaff912de2d28180b7af0 to your computer and use it in GitHub Desktop.
Save shallwefootball/89e9b9a111ceaff912de2d28180b7af0 to your computer and use it in GitHub Desktop.
didn't mockReset created by shallwefootball - https://repl.it/Feas/8
{
"testRegex": ".*-test.js",
"testEnvironment": "node"
}
const fetch = require('./fetch');
describe('fetch', () => {
it('called with GET', () => {
fetch.req = jest.fn();
fetch.reqGet();
expect(fetch.req).toBeCalledWith('GET');
});
it('i want mockReset', () => {
fetch.req.mockReset();
console.log('did not mockReset.. T.T', fetch.req);
});
});
exports.req = method => {
return `request method ${method}`
}
exports.reqGet = () => {
return this.req('GET');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment