Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
Test Cases Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinabgroww committed Apr 22, 2024
1 parent ee41110 commit b0951d5
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions packages/web-storage/test/localStorage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,31 @@ describe('Local Storage Tests', () => {
*/

it('Remove Key from LS', () => {
const key = 'storageLibTest';
const value = key;
const key1 = 'storageLibTest1';
const key2 = 'storageLibTest2';
const value1 = key1;
const value2 = key2;
let testResult = false;

if (!storage.errorInStorage()) {
try {
storage.setDataToStorage(key, value, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE, 10);
storage.clearKeyFromStorage(key, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE);
storage.setDataToStorage(key1, value1, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE, 10);
storage.clearKeyFromStorage(key1, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE);

const result = storage.getDataFromStorage(key, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE);
const result = storage.getDataFromStorage(key1, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE);

if (!result) {
testResult = true;
}

} catch {
testResult = false;
}
try {
storage.setDataToStorageStrict(key2, value2, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE, 10);
storage.clearKeyFromStorage(key2, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE);

const result = storage.getDataFromStorage(key2, storage.STORAGE_TYPE_AVAILABLE.LOCAL_STORAGE);

if (!result) {
testResult = true;
Expand Down

0 comments on commit b0951d5

Please sign in to comment.