Skip to content

Instantly share code, notes, and snippets.

@ruffle1986
Created September 24, 2015 15:50
Show Gist options
  • Select an option

  • Save ruffle1986/21091cfbce4e033607ee to your computer and use it in GitHub Desktop.

Select an option

Save ruffle1986/21091cfbce4e033607ee to your computer and use it in GitHub Desktop.
redux reducer immutability test
import test from 'ava';
import * as actionTypes from './your-action-types';
import reducer from './your-reducer';
import deepEqual from 'deep-equal';
test('reducer:immutability test', t => {
const dummy = {};
for (const action in actionTypes) {
if (actionTypes.hasOwnProperty(action)) {
const result = reducer(dummy, {type: actionTypes[action]});
t.false(deepEqual(dummy, result, {strict: true}));
}
}
t.end();
});
@oroce

oroce commented Sep 24, 2015

Copy link
Copy Markdown

haha nice trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment