Skip to content

Commit

Permalink
fix toContain suggest to contain equal message
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Assasie committed Aug 7, 2018
1 parent 277c547 commit 870ebcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,9 @@ exports[`.toContain(), .toContainEqual() '[{}, []]' does not contain '[]' 1`] =
Expected array:
<red>[{}, []]</>
To contain value:
<green>[]</> <dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
<green>[]</>

<dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
`;

exports[`.toContain(), .toContainEqual() '[{}, []]' does not contain '{}' 1`] = `
Expand All @@ -1526,7 +1528,9 @@ exports[`.toContain(), .toContainEqual() '[{}, []]' does not contain '{}' 1`] =
Expected array:
<red>[{}, []]</>
To contain value:
<green>{}</> <dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
<green>{}</>

<dim>Looks like you wanted to test for object/array equality with the stricter \`toContain\` matcher. You probably need to use \`toContainEqual\` instead.</>"
`;

exports[`.toContain(), .toContainEqual() '[0, 1]' contains '1' 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion packages/expect/src/matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ const matchers: MatchersObject = {
` ${printReceived(collection)}\n` +
`To contain value:\n` +
` ${printExpected(value)}` +
(suggestToContainEqual ? ` ${SUGGEST_TO_CONTAIN_EQUAL}` : '')
(suggestToContainEqual ? `\n\n${SUGGEST_TO_CONTAIN_EQUAL}` : '')
);
};

Expand Down

0 comments on commit 870ebcb

Please sign in to comment.