diff --git a/packages/laco/tests/store.ts b/packages/laco/tests/store.ts index ea2fdcb..7206876 100644 --- a/packages/laco/tests/store.ts +++ b/packages/laco/tests/store.ts @@ -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 }) @@ -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() +})