UNPKG

@schukai/monster

Version:

Monster is a simple library for creating fast, robust and lightweight websites.

47 lines (31 loc) 1.13 kB
"use strict"; import {expect} from "chai" import {SessionStorage} from "../../../../../source/data/datasource/storage/sessionstorage.mjs"; import {createStorage} from "../../../../util/localstorage.mjs"; let storageReference; describe('SessionStorage', function () { afterEach(() => { globalThis['sessionStorage'] = storageReference; }); beforeEach(function () { storageReference = globalThis['sessionStorage'] globalThis['sessionStorage'] = createStorage(); }) it('should instance of SessionStorage ', function () { expect(new SessionStorage('mykey')).to.be.instanceof(SessionStorage) }); describe('rw', function () { it('read should return object', function (done) { const ds = new SessionStorage('mykey') ds.read().then(data => { done(); }).catch(e => done(e)); }); it('write should ', function (done) { const ds = new SessionStorage('mykey') ds.write().then(data => { done(); }).catch(e => done(e)); }); }) })