Fixed some bugs

This commit is contained in:
2021-01-28 15:18:32 -05:00
parent 954049d992
commit 42fa3722fa
15 changed files with 137 additions and 121 deletions

View File

@ -3,7 +3,6 @@ import {LocalStorage, SessionStorage} from "../src";
const CUSTOM_KEY = '_MY_KEY'
const ENCRYPTION_KEY = 'abc123';
class TestType {
constructor(public first: string, public last: string) { }
fullName() { return `${this.last}, ${this.first}`; }
@ -44,6 +43,12 @@ describe('Webstorage Decorators', () => {
expect(localStorage.getItem('localStorage')).toBe(JSON.stringify(testValue));
expect(testComponent.localStorage).toBe(testValue);
});
test('Arrays', () => {
const testValue = [Math.random(), Math.random(), Math.random()];
testComponent.localStorage = testValue;
expect(localStorage.getItem('localStorage')).toBe(JSON.stringify(testValue));
expect(testComponent.localStorage).toBe(testValue);
});
test('String Value', () => {
const testValue = 'SOMETHING_RANDOM';
testComponent.localStorage = testValue;
@ -99,6 +104,12 @@ describe('Webstorage Decorators', () => {
expect(sessionStorage.getItem('sessionStorage')).toBe(JSON.stringify(testValue));
expect(testComponent.sessionStorage).toBe(testValue);
});
test('Arrays', () => {
const testValue = [Math.random(), Math.random(), Math.random()];
testComponent.sessionStorage = testValue;
expect(sessionStorage.getItem('sessionStorage')).toBe(JSON.stringify(testValue));
expect(testComponent.sessionStorage).toBe(testValue);
});
test('String Value', () => {
const testValue = 'SOMETHING_RANDOM';
testComponent.sessionStorage = testValue;