react-native/jest
Emmanouil Konstantinidis 797506f09f Jest - Support Immutable Objects for ListViewDataSource mock
Summary:
Currently the jest mock for `ListViewDataSource` has a property called `items` which returns the number of items of the data source. Example from a snapshot:

    ListViewDataSource {
      "items": 6,
    }

If the datablob includes immutable Maps like:

    const dataBlob = {
      'alpha': immutable.Map({ name: 'Alpha' }),
      'beta': immutable.Map({ name: 'Beta' }),
    };

then the result is:

    ListViewDataSource {
      "items": NaN,
    }

This PR checks if the properties of the `dataBlob` are immutable Maps and then checks whether they are empty.

The result for the above dataBlob would be:

    ListViewDataSource {
      "items": 2,
    }
Closes https://github.com/facebook/react-native/pull/11567

Differential Revision: D4354977

Pulled By: cpojer

fbshipit-source-id: 9f6bd6ea9896eebd9373344a43ffe97deee5015b
2016-12-20 16:58:29 -08:00
..
mockComponent.js RN: Cleanup OSS JS & Flow Declarations 2016-11-20 17:58:29 -08:00
preprocessor.js Moving the jest configuration from jest-react-native to react native. 2016-10-17 08:44:05 -07:00
setup.js Jest - Support Immutable Objects for ListViewDataSource mock 2016-12-20 16:58:29 -08:00