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

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