Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmd committed Dec 4, 2019
1 parent ab8501c commit cff81ee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2537,13 +2537,6 @@ Expected: not <g>StringMatching /bc/</>
Received: <r>"abcd"</>
`;

exports[`.toEqual() {pass: true} expect([1, 2, 3]).not.toEqual([1, 2, 3]) 1`] = `
<d>expect(</><r>received</><d>).</>not<d>.</>toEqual<d>(</><g>expected</><d>) // deep equality</>

Expected: not <g>[1, 2, 3]</>

`;

exports[`.toEqual() {pass: true} expect([1, 2, 3]).not.toEqual(ArrayContaining [2, 3]) 1`] = `
<d>expect(</><r>received</><d>).</>not<d>.</>toEqual<d>(</><g>expected</><d>) // deep equality</>

Expand Down Expand Up @@ -2572,6 +2565,13 @@ Expected: not <g>[97, 98, 99]</>

`;

exports[`.toEqual() {pass: true} expect([97, 98, 99]).not.toEqual([97, 98, 99]) 2`] = `
<d>expect(</><r>received</><d>).</>not<d>.</>toEqual<d>(</><g>expected</><d>) // deep equality</>

Expected: not <g>[97, 98, 99]</>

`;

exports[`.toEqual() {pass: true} expect([Function anonymous]).not.toEqual(Any<Function>) 1`] = `
<d>expect(</><r>received</><d>).</>not<d>.</>toEqual<d>(</><g>expected</><d>) // deep equality</>

Expand Down
19 changes: 17 additions & 2 deletions packages/expect/src/__tests__/matchers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ afterAll(() => {

/* global BigInt */
const isBigIntDefined = typeof BigInt === 'function';
const isTextEncoderDefined = typeof TextEncoder === 'function';

it('should throw if passed two arguments', () => {
expect(() => jestExpect('foo', 'bar')).toThrow(
Expand Down Expand Up @@ -689,8 +690,6 @@ describe('.toEqual()', () => {
Immutable.Map({1: Immutable.Map({2: {a: 99}})}),
Immutable.Map({1: Immutable.Map({2: {a: 99}})}),
],
[new Uint8Array([1, 2, 3]), new Uint8Array([1, 2, 3])],
[new TextEncoder().encode('abc'), new Uint8Array([97, 98, 99])],
[{a: 1, b: 2}, jestExpect.objectContaining({a: 1})],
[[1, 2, 3], jestExpect.arrayContaining([2, 3])],
['abcd', jestExpect.stringContaining('bc')],
Expand Down Expand Up @@ -736,6 +735,22 @@ describe('.toEqual()', () => {
});
});

if (isTextEncoderDefined) {
[
[new Uint8Array([97, 98, 99]), new Uint8Array([97, 98, 99])],
[new TextEncoder().encode('abc'), new Uint8Array([97, 98, 99])],
].forEach(([a, b]) => {
test(`{pass: true} expect(${stringify(a)}).not.toEqual(${stringify(
b,
)})`, () => {
jestExpect(a).toEqual(b);
expect(() =>
jestExpect(a).not.toEqual(b),
).toThrowErrorMatchingSnapshot();
});
});
}

if (isBigIntDefined) {
[
[BigInt(1), BigInt(1)],
Expand Down

0 comments on commit cff81ee

Please sign in to comment.