Skip to content

Commit

Permalink
fix: fix local storage test
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP committed May 9, 2019
1 parent ca5e6fa commit cbe89e2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @jest-environment node
*/

import { localStorage } from "./localStorage";
import { InMemoryStorage } from "./InMemoryStorage";

describe("localStorage", () => {
//use node run time in jest(default jsdom)
it("should return an in-memory storage implementation when indexDB or localStorage is not available", () => {
expect(localStorage()).toBeInstanceOf(InMemoryStorage);
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { localStorage } from "./localStorage";
import { IndexedDbStorage } from "./IndexedDbStorage";
import { InMemoryStorage } from "./InMemoryStorage";

describe("localStorage", () => {
const storageAtInit: Storage | undefined = window && window.localStorage;
Expand Down Expand Up @@ -47,8 +46,4 @@ describe("localStorage", () => {

expect(localStorage()).toBe(window.localStorage);
});

/*it("should return an in-memory storage implementation otherwise", () => {
expect(localStorage()).toBeInstanceOf(InMemoryStorage);
});*/
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"strict": false,
"sourceMap": false,
"inlineSourceMap": true,
"inlineSources": true,
"noImplicitUseStrict": true,
"rootDir": "./src",
"outDir": "./build"
}
Expand Down

0 comments on commit cbe89e2

Please sign in to comment.