@schukai/monster
Version:
Monster is a simple library for creating fast, robust and lightweight websites.
47 lines (31 loc) • 1.12 kB
JavaScript
;
import {expect} from "chai"
import {LocalStorage} from "../../../../../source/data/datasource/storage/localstorage.mjs";
import {createStorage} from "../../../../util/localstorage.mjs";
let localStorageReference;
describe('LocalStorage', function () {
afterEach(() => {
globalThis['localStorage'] = localStorageReference;
});
beforeEach(function () {
localStorageReference = globalThis['localStorage']
globalThis['localStorage'] = createStorage();
})
it('should instance of LocalStorage ', function () {
expect(new LocalStorage('mykey')).to.be.instanceof(LocalStorage)
});
describe('rw', function () {
it('read should return object', function (done) {
const ds = new LocalStorage('mykey')
ds.read().then(data => {
done();
}).catch(e => done(e));
});
it('write should ', function (done) {
const ds = new LocalStorage('mykey')
ds.write().then(data => {
done();
}).catch(e => done(e));
});
})
})