Skip to content

Commit

Permalink
Added tests for new global state methods
Browse files Browse the repository at this point in the history
  • Loading branch information
deamme committed Sep 1, 2018
1 parent 88129f9 commit 1388023
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/laco/tests/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as test from 'tape'
import { Store } from '../dist'
import { Store, getGlobalState, resetGlobalState, replaceGlobalState } from '../dist'

test('Correct store index', t => {
const FirstStore = new Store({ test: true })
Expand Down Expand Up @@ -138,3 +138,14 @@ test('TestStore actions with condition', t => {

t.end()
})

test('Global state', t => {
resetGlobalState()
t.assert(JSON.stringify(getGlobalState()) === JSON.stringify({}))

const newGlobalState = { 0: { test: true }}
replaceGlobalState(newGlobalState)
t.assert(JSON.stringify(getGlobalState()) === JSON.stringify(getGlobalState()))

t.end()
})

0 comments on commit 1388023

Please sign in to comment.