Skip to content

Commit

Permalink
Merge 8e68f86 into e9f2f30
Browse files Browse the repository at this point in the history
  • Loading branch information
aknuds1 committed Mar 2, 2017
2 parents e9f2f30 + 8e68f86 commit 591daf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function dispatcher (hooks) {
_state = wrapHook(_state, initialStateWraps)
}

if (!opts.noSubscriptions) subsCalled = true
if (opts.subscriptions !== false) subsCalled = true
if (!opts.noReducers) reducersCalled = true
if (!opts.noEffects) effectsCalled = true
if (!opts.noState) stateCalled = true
Expand Down
11 changes: 11 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ tape('api: createSend = store.start(opts)', (t) => {
const subscriptions = Object.keys(store._subscriptions)
t.deepEqual(subscriptions.length, 0, 'no subscriptions registered')
})

t.test('opts.subscriptions = true should register subs after initial call with subs disabled',
(t) => {
t.plan(1)
const store = barracks()
store.model({ subscriptions: { foo: noop } })
store.start({ subscriptions: false })
store.start()
const subscriptions = Object.keys(store._subscriptions)
t.deepEqual(subscriptions.length, 1, 'subscriptions registered')
})
})

tape('api: state = store.state()', (t) => {
Expand Down

0 comments on commit 591daf6

Please sign in to comment.