0.2.1 • Published 7 years ago

jasmine-react-shallow-equal v0.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

jasmine-react-shallow-equal

Unit test against inadvertent performance problems.

Provides a toShallowEqual matcher for jasmine. This matcher can aid in writing performant code as it allows you to write unit tests which ensure that shallowEqual always returns true when the underlying values tested have not changed.

Usage

The tests give examples of how to use this to test mapStateToProps and higher-order components (HOCs).

Install

npm install --save-dev jasmine-react-shallow-equal

The installShallowEqualMatcher function must be called within a spec's beforeEach or beforeAll and must be run before testing code.

import installShallowEqualMatcher from 'jasmine-react-shallow-equal'

describe('some suite', () => {
  beforeAll(() => installShallowEqualMatcher())

  it('some test', () => {
    // ...
  })
})