From 138802315cea7189b8f30bcc7b1ddaa1cebc9966 Mon Sep 17 00:00:00 2001 From: deam Date: Sat, 1 Sep 2018 20:07:23 +0200 Subject: [PATCH] Added tests for new global state methods --- packages/laco/tests/store.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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() +})