UNPKG

redux-contexts

Version:

[![NPM Version](https://img.shields.io/npm/v/redux-contexts.svg?style=flat-square)](https://www.npmjs.com/package/multireducer) [![Build status](https://img.shields.io/travis/Vinnovera/redux-contexts/master.svg?style=flat-square)](https://travis-ci.org/Vi

20 lines (17 loc) 467 B
import key from '../src/key'; import contextFromState from '../src/contextFromState'; describe('contextFromState', () => { const state = { [key]: { 'foo': { 'bar': 'baz' } } }; it('should return the context state', () => { expect(contextFromState(state, 'foo')).toEqual({ 'bar': 'baz' }) }); it('should return the state if context name is not found', () => { expect(contextFromState(state, 'bar')).toEqual(state) }); });