Skip to content

Commit

Permalink
chore: do not escape strings in snapshots (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Aug 31, 2022
1 parent d329f95 commit 28862f7
Show file tree
Hide file tree
Showing 38 changed files with 174 additions and 174 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
"/node_modules/"
],
"snapshotFormat": {
"escapeString": true,
"printBasicPrototype": true
"escapeString": false,
"printBasicPrototype": false
},
"snapshotSerializers": [
"jest-serializer-ansi-escapes"
Expand Down
18 changes: 9 additions & 9 deletions test/matchers/__snapshots__/toBeArrayOfSize.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Expected value to be an array of size:
<green>1</color>
Received:
value: <red>{}</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;

exports[`.toBeArrayOfSize fails when given type of 0 which is not an array 1`] = `
Expand All @@ -47,7 +47,7 @@ Expected value to be an array of size:
<green>1</color>
Received:
value: <red>0</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;

exports[`.toBeArrayOfSize fails when given type of NaN which is not an array 1`] = `
Expand All @@ -57,7 +57,7 @@ Expected value to be an array of size:
<green>1</color>
Received:
value: <red>NaN</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;

exports[`.toBeArrayOfSize fails when given type of false which is not an array 1`] = `
Expand All @@ -67,7 +67,7 @@ Expected value to be an array of size:
<green>1</color>
Received:
value: <red>false</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;

exports[`.toBeArrayOfSize fails when given type of null which is not an array 1`] = `
Expand All @@ -77,7 +77,7 @@ Expected value to be an array of size:
<green>1</color>
Received:
value: <red>null</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;

exports[`.toBeArrayOfSize fails when given type of true which is not an array 1`] = `
Expand All @@ -87,7 +87,7 @@ Expected value to be an array of size:
<green>1</color>
Received:
value: <red>true</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;

exports[`.toBeArrayOfSize fails when given type of undefined which is not an array 1`] = `
Expand All @@ -97,7 +97,7 @@ Expected value to be an array of size:
<green>1</color>
Received:
value: <red>undefined</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;

exports[`.toBeArrayOfSize fails when given type which is not an array 1`] = `
Expand All @@ -107,7 +107,7 @@ Expected value to be an array of size:
<green>1</color>
Received:
value: <red>false</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;

exports[`.toBeArrayOfSize fails when not given a parameter 1`] = `
Expand All @@ -127,5 +127,5 @@ Expected value to be an array of size:
<green>5</color>
Received:
value: <red>undefined</color>
length: <red>\\"Not Accessible\\"</color>"
length: <red>"Not Accessible"</color>"
`;
4 changes: 2 additions & 2 deletions test/matchers/__snapshots__/toBeDateString.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ exports[`.not.toBeDateString fails when given a date string 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).not.toBeDateString()</intensity>
Expected value to not be a date string received:
<red>\\"2018-01-01T13:00:00.000Z\\"</color>"
<red>"2018-01-01T13:00:00.000Z"</color>"
`;

exports[`.toBeDateString fails when not given a date string 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeDateString()</intensity>
Expected value to be a date string received:
<red>\\"not a date\\"</color>"
<red>"not a date"</color>"
`;
4 changes: 2 additions & 2 deletions test/matchers/__snapshots__/toBeEmpty.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ exports[`.not.toBeEmpty fails when given empty string 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).not.toBeEmpty()</intensity>
Expected value to not be empty received:
<red>\\"\\"</color>"
<red>""</color>"
`;

exports[`.toBeEmpty fails when given non-empty string 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeEmpty()</intensity>
Expected value to be empty received:
<red>\\"string\\"</color>"
<red>"string"</color>"
`;
2 changes: 1 addition & 1 deletion test/matchers/__snapshots__/toBeEmptyObject.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ exports[`.toBeEmptyObject fails when not given an empty object 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeEmptyObject()</intensity>
Expected value to be an empty object, received:
<red>{\\"property1\\": \\"something\\"}</color>"
<red>{"property1": "something"}</color>"
`;
2 changes: 1 addition & 1 deletion test/matchers/__snapshots__/toBeEven.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports[`.toBeEven fails when not given an even number 3`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeEven()</intensity>
Expected value to be an even number received:
<red>\\"\\"</color>"
<red>""</color>"
`;

exports[`.toBeEven fails when not given an even number 4`] = `
Expand Down
2 changes: 1 addition & 1 deletion test/matchers/__snapshots__/toBeExtensible.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`.toBeExtensible fails when not given an extensible object: 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeExtensible()</intensity>
Expected value to be extensible received:
<red>\\"\\"</color>"
<red>""</color>"
`;

exports[`.toBeExtensible fails when not given an extensible object: {} 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion test/matchers/__snapshots__/toBeHexadecimal.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`.not.toBeHexadecimal fails when given valid hexadecimal 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).not.toBeHexadecimal()</intensity>
Expected value to not be a hexadecimal, received:
<red>\\"#eeffee\\"</color>"
<red>"#eeffee"</color>"
`;

exports[`.toBeHexadecimal fails when given non-string 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion test/matchers/__snapshots__/toBeNil.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ exports[`.toBeNil fails when the value is not null or undefined 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeNil()</intensity>
Expected value to be null or undefined, received:
<red>\\"value\\"</color>"
<red>"value"</color>"
`;
2 changes: 1 addition & 1 deletion test/matchers/__snapshots__/toBeObject.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`.toBeObject fails when not given an object: 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeObject()</intensity>
Expected value to be an object, received:
<red>\\"\\"</color>"
<red>""</color>"
`;

exports[`.toBeObject fails when not given an object: () => {} 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion test/matchers/__snapshots__/toBeOdd.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports[`.toBeOdd fails when given not given an odd number 3`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeOdd()</intensity>
Expected value to be odd received:
<red>\\"\\"</color>"
<red>""</color>"
`;

exports[`.toBeOdd fails when given not given an odd number 4`] = `
Expand Down
8 changes: 4 additions & 4 deletions test/matchers/__snapshots__/toBeString.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ exports[`.not.toBeString fails when given a string literal 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).not.toBeString()</intensity>
Expected value to not be of type string received:
<red>\\"\\"</color>"
<red>""</color>"
`;

exports[`.not.toBeString fails when given an object of type string 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).not.toBeString()</intensity>
Expected value to not be of type string received:
<red>{\\"0\\": \\"s\\", \\"1\\": \\"t\\", \\"10\\": \\"e\\", \\"2\\": \\"r\\", \\"3\\": \\"i\\", \\"4\\": \\"n\\", \\"5\\": \\"g\\", \\"6\\": \\" \\", \\"7\\": \\"t\\", \\"8\\": \\"y\\", \\"9\\": \\"p\\"}</color>"
<red>{"0": "s", "1": "t", "10": "e", "2": "r", "3": "i", "4": "n", "5": "g", "6": " ", "7": "t", "8": "y", "9": "p"}</color>"
`;

exports[`.toBeString fails when not given a string 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toBeString()</intensity>
Expected value to be of type string:
<green>\\"type of string\\"</color>
<green>"type of string"</color>
Received:
<red>\\"number\\"</color>"
<red>"number"</color>"
`;
8 changes: 4 additions & 4 deletions test/matchers/__snapshots__/toContainAllEntries.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ exports[`.not.toContainAllEntries fails when object only contains all of the giv
"<dim>expect(</intensity><red>received</color><dim>).not.toContainAllEntries(</intensity><green>expected</color><dim>)</intensity>
Expected object to not only contain all of the given entries:
<green>[[\\"b\\", \\"bar\\"], [\\"a\\", \\"foo\\"], [\\"c\\", \\"baz\\"]]</color>
<green>[["b", "bar"], ["a", "foo"], ["c", "baz"]]</color>
Received:
<red>{\\"a\\": \\"foo\\", \\"b\\": \\"bar\\", \\"c\\": \\"baz\\"}</color>"
<red>{"a": "foo", "b": "bar", "c": "baz"}</color>"
`;

exports[`.toContainAllEntries fails when object does not only contain all of the given entries 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAllEntries(</intensity><green>expected</color><dim>)</intensity>
Expected object to only contain all of the given entries:
<green>[[\\"a\\", \\"foo\\"], [\\"b\\", \\"bar\\"]]</color>
<green>[["a", "foo"], ["b", "bar"]]</color>
Received:
<red>{\\"a\\": \\"foo\\", \\"b\\": \\"bar\\", \\"c\\": \\"baz\\"}</color>"
<red>{"a": "foo", "b": "bar", "c": "baz"}</color>"
`;
14 changes: 7 additions & 7 deletions test/matchers/__snapshots__/toContainAllKeys.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ exports[`.not.toContainAllKeys fails when given object contains all keys 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).not.toContainAllKeys(</intensity><green>expected</color><dim>)</intensity>
Expected object to not contain all keys:
<green>[\\"b\\", \\"a\\"]</color>
<green>["b", "a"]</color>
Received:
<red>[\\"a\\", \\"b\\"]</color>"
<red>["a", "b"]</color>"
`;

exports[`.toContainAllKeys fails when all of the object keys are matched, but there are additional keys 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAllKeys(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain all keys:
<green>[\\"a\\", \\"c\\"]</color>
<green>["a", "c"]</color>
Received:
<red>[\\"a\\", \\"b\\"]</color>"
<red>["a", "b"]</color>"
`;

exports[`.toContainAllKeys fails when given an empty object 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAllKeys(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain all keys:
<green>[\\"a\\"]</color>
<green>["a"]</color>
Received:
<red>[]</color>"
`;
Expand All @@ -31,7 +31,7 @@ exports[`.toContainAllKeys fails when given object does not contain all keys 1`]
"<dim>expect(</intensity><red>received</color><dim>).toContainAllKeys(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain all keys:
<green>[\\"a\\"]</color>
<green>["a"]</color>
Received:
<red>[\\"a\\", \\"b\\"]</color>"
<red>["a", "b"]</color>"
`;
28 changes: 14 additions & 14 deletions test/matchers/__snapshots__/toContainAllValues.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,61 @@ exports[`.not.toContainAllValues fails when given object contains all values inc
"<dim>expect(</intensity><red>received</color><dim>).not.toContainAllValues(</intensity><green>expected</color><dim>)</intensity>
Expected object to not contain all values:
<green>[\\"duck\\", [{\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}]]</color>
<green>["duck", [{"bar": false, "foo": 0, "hello": "world"}]]</color>
Received:
<red>{\\"donald\\": \\"duck\\", \\"message\\": [{\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}]}</color>"
<red>{"donald": "duck", "message": [{"bar": false, "foo": 0, "hello": "world"}]}</color>"
`;

exports[`.not.toContainAllValues fails when given object contains all values including objects 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).not.toContainAllValues(</intensity><green>expected</color><dim>)</intensity>
Expected object to not contain all values:
<green>[{\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}, \\"duck\\"]</color>
<green>[{"bar": false, "foo": 0, "hello": "world"}, "duck"]</color>
Received:
<red>{\\"donald\\": \\"duck\\", \\"message\\": {\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}}</color>"
<red>{"donald": "duck", "message": {"bar": false, "foo": 0, "hello": "world"}}</color>"
`;

exports[`.not.toContainAllValues fails when given object contains primitive values 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).not.toContainAllValues(</intensity><green>expected</color><dim>)</intensity>
Expected object to not contain all values:
<green>[\\"world\\", 0, false]</color>
<green>["world", 0, false]</color>
Received:
<red>{\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}</color>"
<red>{"bar": false, "foo": 0, "hello": "world"}</color>"
`;

exports[`.toContainAllValues fails when given object does not contain all primitive values 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAllValues(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain all values:
<green>[\\"hello\\", 0, false]</color>
<green>["hello", 0, false]</color>
Received:
<red>{\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}</color>"
<red>{"bar": false, "foo": 0, "hello": "world"}</color>"
`;

exports[`.toContainAllValues fails when given object does not contain all primitive values 2`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAllValues(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain all values:
<green>[\\"world\\", 0]</color>
<green>["world", 0]</color>
Received:
<red>{\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}</color>"
<red>{"bar": false, "foo": 0, "hello": "world"}</color>"
`;

exports[`.toContainAllValues fails when given object does not contain all values including arrays 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAllValues(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain all values:
<green>[\\"duck\\", [{\\"hello\\": \\"world\\"}]]</color>
<green>["duck", [{"hello": "world"}]]</color>
Received:
<red>{\\"donald\\": \\"duck\\", \\"message\\": [{\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}]}</color>"
<red>{"donald": "duck", "message": [{"bar": false, "foo": 0, "hello": "world"}]}</color>"
`;

exports[`.toContainAllValues fails when given object does not contain all values including objects 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAllValues(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain all values:
<green>[{\\"hello\\": \\"world\\"}]</color>
<green>[{"hello": "world"}]</color>
Received:
<red>{\\"donald\\": \\"duck\\", \\"message\\": {\\"bar\\": false, \\"foo\\": 0, \\"hello\\": \\"world\\"}}</color>"
<red>{"donald": "duck", "message": {"bar": false, "foo": 0, "hello": "world"}}</color>"
`;
8 changes: 4 additions & 4 deletions test/matchers/__snapshots__/toContainAnyEntries.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ exports[`.not.toContainAnyEntries fails when given object contains atleast one o
"<dim>expect(</intensity><red>received</color><dim>).not.toContainAnyEntries(</intensity><green>expected</color><dim>)</intensity>
Expected object to not contain any of the provided entries:
<green>[[\\"a\\", \\"qux\\"], [\\"a\\", \\"foo\\"]]</color>
<green>[["a", "qux"], ["a", "foo"]]</color>
Received:
<red>{\\"a\\": \\"foo\\", \\"b\\": \\"bar\\", \\"c\\": \\"baz\\"}</color>"
<red>{"a": "foo", "b": "bar", "c": "baz"}</color>"
`;

exports[`.toContainAnyEntries fails when given object does not contain any of the given entries 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAnyEntries(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain any of the provided entries:
<green>[[\\"a\\", \\"qux\\"], [\\"b\\", \\"foo\\"]]</color>
<green>[["a", "qux"], ["b", "foo"]]</color>
Received:
<red>{\\"a\\": \\"foo\\", \\"b\\": \\"bar\\", \\"c\\": \\"baz\\"}</color>"
<red>{"a": "foo", "b": "bar", "c": "baz"}</color>"
`;
8 changes: 4 additions & 4 deletions test/matchers/__snapshots__/toContainAnyKeys.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ exports[`.not.toContainAnyKeys fails when object contains one or more keys 1`] =
"<dim>expect(</intensity><red>received</color><dim>).not.toContainAnyKeys(</intensity><green>expected</color><dim>)</intensity>
Expected object not to contain any of the following keys:
<green>[\\"name\\", \\"age\\"]</color>
<green>["name", "age"]</color>
Received:
<red>{\\"age\\": 37, \\"name\\": \\"Steve the Pirate\\"}</color>"
<red>{"age": 37, "name": "Steve the Pirate"}</color>"
`;

exports[`.toContainAnyKeys fails when object does not contain any keys 1`] = `
"<dim>expect(</intensity><red>received</color><dim>).toContainAnyKeys(</intensity><green>expected</color><dim>)</intensity>
Expected object to contain any of the following keys:
<green>[\\"occupation\\"]</color>
<green>["occupation"]</color>
Received:
<red>{\\"age\\": 37, \\"name\\": \\"Steve the Pirate\\"}</color>"
<red>{"age": 37, "name": "Steve the Pirate"}</color>"
`;
Loading

0 comments on commit 28862f7

Please sign in to comment.