Skip to content

Commit

Permalink
Fix test and update snapshot to meet expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
jessecarfb committed Feb 14, 2018
1 parent 9c7ab13 commit 66e3f39
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ Expected mock function to have been last called with:
<green>\\"bar\\"</> as argument 2, but it was called with <red>\\"bar3\\"</>."
`;

exports[`lastCalledWith works with trailing undefined arguments 1`] = `
"<dim>expect(</><red>jest.fn()</><dim>).lastCalledWith(</><green>expected</><dim>)</>

Expected mock function to have been last called with:
Did not expect argument 2 but it was called with <red>undefined</>."
`;

exports[`toBeCalled works only on spies or jest.fn 1`] = `
"<dim>expect(</><red>jest.fn()</><dim>)[.not].toBeCalled(</><dim>)</>

Expand Down Expand Up @@ -302,6 +309,13 @@ Expected mock function to have been called with:
<green>\\"bar\\"</> as argument 2, but it was called with <red>\\"bar1\\"</>."
`;

exports[`toHaveBeenCalledWith works with trailing undefined arguments 1`] = `
"<dim>expect(</><red>jest.fn()</><dim>).toHaveBeenCalledWith(</><green>expected</><dim>)</>

Expected mock function to have been called with:
Did not expect argument 2 but it was called with <red>undefined</>."
`;

exports[`toHaveBeenLastCalledWith works only on spies or jest.fn 1`] = `
"<dim>expect(</><red>jest.fn()</><dim>)[.not].toHaveBeenLastCalledWith(</><dim>)</>

Expand Down Expand Up @@ -380,3 +394,10 @@ exports[`toHaveBeenLastCalledWith works with many arguments that don't match 1`]
Expected mock function to have been last called with:
<green>\\"bar\\"</> as argument 2, but it was called with <red>\\"bar3\\"</>."
`;

exports[`toHaveBeenLastCalledWith works with trailing undefined arguments 1`] = `
"<dim>expect(</><red>jest.fn()</><dim>).toHaveBeenLastCalledWith(</><green>expected</><dim>)</>

Expected mock function to have been last called with:
Did not expect argument 2 but it was called with <red>undefined</>."
`;
4 changes: 1 addition & 3 deletions packages/expect/src/__tests__/spy_matchers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ describe('toHaveBeenCalledTimes', () => {
const fn = jest.fn();
fn('foo', undefined);

jestExpect(fn)[calledWith]('foo');

expect(() =>
jestExpect(fn).not[calledWith]('foo'),
jestExpect(fn)[calledWith]('foo'),
).toThrowErrorMatchingSnapshot();
});

Expand Down

0 comments on commit 66e3f39

Please sign in to comment.