switch toBe to toStrictEqual in testenv.test.js

This commit is contained in:
Arthur Lu 2022-11-07 21:17:05 +00:00
parent f5b2953c33
commit b680b83dcc

View File

@ -24,13 +24,13 @@ describe("test localStorage mock", () => {
saveToLocal("testkey3", "testvalue3");
saveToLocal("testkey4", "testvalue4");
expect(getFromLocal("testkey1")).toBe("testvalue1");
expect(getFromLocal("testkey2")).toBe("testvalue2");
expect(getFromLocal("testkey3")).toBe("testvalue3");
expect(getFromLocal("testkey4")).toBe("testvalue4");
expect(getFromLocal("testkey1")).toStrictEqual("testvalue1");
expect(getFromLocal("testkey2")).toStrictEqual("testvalue2");
expect(getFromLocal("testkey3")).toStrictEqual("testvalue3");
expect(getFromLocal("testkey4")).toStrictEqual("testvalue4");
saveToLocal("testkey6", "testvalue5");
expect(getFromLocal("testkey6")).toBe("testvalue5");
expect(getFromLocal("testkey6")).toStrictEqual("testvalue5");
});
test("test delete and fetch", () => {
@ -42,31 +42,31 @@ describe("test localStorage mock", () => {
removeFromLocal("testkey3");
expect(getFromLocal("testkey1")).toBe("testvalue1");
expect(getFromLocal("testkey2")).toBe("testvalue2");
expect(getFromLocal("testkey3")).toBe(null);
expect(getFromLocal("testkey4")).toBe("testvalue4");
expect(getFromLocal("testkey1")).toStrictEqual("testvalue1");
expect(getFromLocal("testkey2")).toStrictEqual("testvalue2");
expect(getFromLocal("testkey3")).toStrictEqual(null);
expect(getFromLocal("testkey4")).toStrictEqual("testvalue4");
removeFromLocal("testkey1");
expect(getFromLocal("testkey1")).toBe(null);
expect(getFromLocal("testkey2")).toBe("testvalue2");
expect(getFromLocal("testkey3")).toBe(null);
expect(getFromLocal("testkey4")).toBe("testvalue4");
expect(getFromLocal("testkey1")).toStrictEqual(null);
expect(getFromLocal("testkey2")).toStrictEqual("testvalue2");
expect(getFromLocal("testkey3")).toStrictEqual(null);
expect(getFromLocal("testkey4")).toStrictEqual("testvalue4");
removeFromLocal("testkey4");
expect(getFromLocal("testkey1")).toBe(null);
expect(getFromLocal("testkey2")).toBe("testvalue2");
expect(getFromLocal("testkey3")).toBe(null);
expect(getFromLocal("testkey4")).toBe(null);
expect(getFromLocal("testkey1")).toStrictEqual(null);
expect(getFromLocal("testkey2")).toStrictEqual("testvalue2");
expect(getFromLocal("testkey3")).toStrictEqual(null);
expect(getFromLocal("testkey4")).toStrictEqual(null);
removeFromLocal("testkey2");
expect(getFromLocal("testkey1")).toBe(null);
expect(getFromLocal("testkey2")).toBe(null);
expect(getFromLocal("testkey3")).toBe(null);
expect(getFromLocal("testkey4")).toBe(null);
expect(getFromLocal("testkey1")).toStrictEqual(null);
expect(getFromLocal("testkey2")).toStrictEqual(null);
expect(getFromLocal("testkey3")).toStrictEqual(null);
expect(getFromLocal("testkey4")).toStrictEqual(null);
});
test("test clear and fetch", () => {
@ -78,9 +78,9 @@ describe("test localStorage mock", () => {
clearLocal();
expect(getFromLocal("testkey1")).toBe(null);
expect(getFromLocal("testkey2")).toBe(null);
expect(getFromLocal("testkey3")).toBe(null);
expect(getFromLocal("testkey4")).toBe(null);
expect(getFromLocal("testkey1")).toStrictEqual(null);
expect(getFromLocal("testkey2")).toStrictEqual(null);
expect(getFromLocal("testkey3")).toStrictEqual(null);
expect(getFromLocal("testkey4")).toStrictEqual(null);
});
});