Skip to content

Commit

Permalink
Replace print with serialize in Immutable plugins (#4189)
Browse files Browse the repository at this point in the history
* Replace print with serialize in Immutable plugins

* Delete multiline string key to avoid conflict with 4183

* Update 3 snapshot tests

* Replace printRecordProperties with getRecordIterator

* Export 3 print functions from renamed immutable.js file

* Move comment

* Roll up immutable plugins

* Replace getName with getImmutableName

* Move Seq after all other types except Record

* Delete newlines between adjacent import and sentinel lines
  • Loading branch information
pedrottimark authored and cpojer committed Aug 6, 2017
1 parent e3052b4 commit ee928fd
Show file tree
Hide file tree
Showing 17 changed files with 595 additions and 416 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports[`lastCalledWith works with Immutable.js objects 1`] = `
"<dim>expect(<red>jest.fn()</><dim>).not.lastCalledWith(<green>expected</><dim>)

Expected mock function to not have been last called with:
<green>[Immutable.Map {a: {\\"b\\": \\"c\\"}}, Immutable.Map {a: {\\"b\\": \\"c\\"}}]</>"
<green>[Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]</>"
`;

exports[`lastCalledWith works with Map 1`] = `
Expand Down Expand Up @@ -239,7 +239,7 @@ exports[`toHaveBeenCalledWith works with Immutable.js objects 1`] = `
"<dim>expect(<red>jest.fn()</><dim>).not.toHaveBeenCalledWith(<green>expected</><dim>)

Expected mock function not to have been called with:
<green>[Immutable.Map {a: {\\"b\\": \\"c\\"}}, Immutable.Map {a: {\\"b\\": \\"c\\"}}]</>"
<green>[Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]</>"
`;

exports[`toHaveBeenCalledWith works with Map 1`] = `
Expand Down Expand Up @@ -322,7 +322,7 @@ exports[`toHaveBeenLastCalledWith works with Immutable.js objects 1`] = `
"<dim>expect(<red>jest.fn()</><dim>).not.toHaveBeenLastCalledWith(<green>expected</><dim>)

Expected mock function to not have been last called with:
<green>[Immutable.Map {a: {\\"b\\": \\"c\\"}}, Immutable.Map {a: {\\"b\\": \\"c\\"}}]</>"
<green>[Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]</>"
`;

exports[`toHaveBeenLastCalledWith works with Map 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-snapshot/src/__tests__/plugins.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const testPath = names => {
it('gets plugins', () => {
const {getSerializers} = require('../plugins');
const plugins = getSerializers();
expect(plugins.length).toBe(10);
expect(plugins.length).toBe(4);
});

it('adds plugins from an empty array', () => testPath([]));
Expand Down
10 changes: 5 additions & 5 deletions packages/pretty-format/src/__tests__/expect_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@

'use strict';

import type {Plugins} from 'types/PrettyFormat';
import type {OptionsReceived, Plugins} from 'types/PrettyFormat';

const diff = require('jest-diff');
const prettyFormat = require('../');

module.exports = {
getPrettyPrint: (plugins: Plugins) =>
function(received: any, expected: any, opts: any) {
function(received: any, expected: any, options?: OptionsReceived) {
const prettyFormatted = prettyFormat(
received,
Object.assign(
{
({
plugins,
},
opts,
}: OptionsReceived),
options,
),
);
const pass = prettyFormatted === expected;
Expand Down
Loading

0 comments on commit ee928fd

Please sign in to comment.