diff --git a/types/expired-storage/expired-storage-tests.ts b/types/expired-storage/expired-storage-tests.ts index 269a8a61f3..fa2dd29ef7 100644 --- a/types/expired-storage/expired-storage-tests.ts +++ b/types/expired-storage/expired-storage-tests.ts @@ -1,7 +1,8 @@ -// import { LocalStorage } from 'node-localstorage'; +// import { LocalStorage } from 'node-localstorage'; // Removed since this pkg isn't getting installed. import ExpiredStorage = require('expired-storage'); // const localStorage = new LocalStorage('./scratch', Infinity); +// const expiredStorage = new ExpiredStorage(localStorage); // ExpiredStorage requires a LocalStorage provider const expiredStorage = new ExpiredStorage(); const mjkModel = { @@ -26,7 +27,9 @@ if (typeof mjkTest === 'undefined' || mjkTest.firstName !== mjkModel.firstName | throw new Error('.setJson method is not working!'); } -if (expiredStorage.keys(true).length === 2) { +const keyCheck = expiredStorage.keys(true); + +if (keyCheck && keyCheck.length === 2) { throw new Error('.keys method has failed.'); } @@ -44,7 +47,7 @@ do { const expiredKeys = expiredStorage.clearExpired(); -if (expiredKeys.indexOf('apc') === -1) { +if (expiredKeys.indexOf('apc') !== -1) { throw new Error('.clearExpired did not work..'); } @@ -56,7 +59,9 @@ expiredStorage.setItem('puscifer', 'the humbling river', 10000); expiredStorage.updateExpiration('puscifer', 5000); -if (expiredStorage.getTimeLeft('puscifer') >= 10000) { +const checkKeyTime = expiredStorage.getTimeLeft('puscifer'); + +if (checkKeyTime && checkKeyTime >= 10000) { throw new Error('.updateExpiration method is broken -- or .getTimeLeft method is broken.'); } diff --git a/types/expired-storage/tsconfig.json b/types/expired-storage/tsconfig.json index 035c1af35e..cd1454cca7 100644 --- a/types/expired-storage/tsconfig.json +++ b/types/expired-storage/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/expired-storage/tslint.json b/types/expired-storage/tslint.json index 705507d3a2..e60c15844f 100644 --- a/types/expired-storage/tslint.json +++ b/types/expired-storage/tslint.json @@ -1,8 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-void-expression": false, - "no-duplicate-imports": false, - "no-unnecessary-generics": false - } + "extends": "dtslint/dt.json" } \ No newline at end of file