import { expect } from 'chai'; import 'mocha'; import { container } from '../../core/container'; describe('Store Service', function () { this.timeout(10000); it('loads saved data', () => { const store: StoreInterface = container.get('store'); const testData = { something: 'gaga', somethingElse: 0, deepObject: { somethingAsWell: true, somethingNotInJson: undefined, someArray: [ 'hui', { g: 'h', }, ], }, }; const expectedJson = JSON.stringify(testData); return store .save(StoreKey.COOKIES, testData) .then(() => store.load(StoreKey.COOKIES)) .then((data) => { expect(JSON.stringify(data)).to.equal(expectedJson, 'store does not save and load data correctly'); return store.load(StoreKey.COOKIES); }) .then((data) => { expect(JSON.stringify(data)).to.equal(expectedJson, 'store does not load data correctly when loaded twice'); }); }); });