Skip to content

Commit cbe89e2

Browse files
committed
fix: fix local storage test
1 parent ca5e6fa commit cbe89e2

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
5+
import { localStorage } from "./localStorage";
6+
import { InMemoryStorage } from "./InMemoryStorage";
7+
8+
describe("localStorage", () => {
9+
//use node run time in jest(default jsdom)
10+
it("should return an in-memory storage implementation when indexDB or localStorage is not available", () => {
11+
expect(localStorage()).toBeInstanceOf(InMemoryStorage);
12+
});
13+
});

packages/credential-provider-cognito-identity/src/localStorage.spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { localStorage } from "./localStorage";
22
import { IndexedDbStorage } from "./IndexedDbStorage";
3-
import { InMemoryStorage } from "./InMemoryStorage";
43

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

4847
expect(localStorage()).toBe(window.localStorage);
4948
});
50-
51-
/*it("should return an in-memory storage implementation otherwise", () => {
52-
expect(localStorage()).toBeInstanceOf(InMemoryStorage);
53-
});*/
5449
});

packages/credential-provider-cognito-identity/tsconfig.test.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4+
"strict": false,
45
"sourceMap": false,
56
"inlineSourceMap": true,
67
"inlineSources": true,
8+
"noImplicitUseStrict": true,
79
"rootDir": "./src",
810
"outDir": "./build"
911
}

0 commit comments

Comments
 (0)