diff options
| author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-26 17:01:31 +0900 | 
|---|---|---|
| committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-26 17:23:14 +0900 | 
| commit | e304581fb15eabb3a973d363a282ee7546561e01 (patch) | |
| tree | 1afb21a2dee2ada3d10c1417fa61c0aae1f83077 /test/background/infrastructures | |
| parent | 11d6d725eee2ac0a1c16e4c7a4ce4f296bb6b016 (diff) | |
Do not use chai on unit test
Diffstat (limited to 'test/background/infrastructures')
| -rw-r--r-- | test/background/infrastructures/MemoryStorage.test.ts | 15 | 
1 files changed, 7 insertions, 8 deletions
| diff --git a/test/background/infrastructures/MemoryStorage.test.ts b/test/background/infrastructures/MemoryStorage.test.ts index 1c67b18..6618549 100644 --- a/test/background/infrastructures/MemoryStorage.test.ts +++ b/test/background/infrastructures/MemoryStorage.test.ts @@ -1,22 +1,21 @@  import MemoryStorage from "../../../src/background/infrastructures/MemoryStorage"; -import { expect } from "chai";  describe("background/infrastructures/memory-storage", () => {    it("stores values", () => {      const cache = new MemoryStorage();      cache.set("number", 123); -    expect(cache.get("number")).to.equal(123); +    expect(cache.get("number")).toEqual(123);      cache.set("string", "123"); -    expect(cache.get("string")).to.equal("123"); +    expect(cache.get("string")).toEqual("123");      cache.set("object", { hello: "123" }); -    expect(cache.get("object")).to.deep.equal({ hello: "123" }); +    expect(cache.get("object")).toEqual({ hello: "123" });    });    it("returns undefined if no keys", () => {      const cache = new MemoryStorage(); -    expect(cache.get("no-keys")).to.be.undefined; +    expect(cache.get("no-keys")).toBeUndefined;    });    it("stored on shared memory", () => { @@ -25,7 +24,7 @@ describe("background/infrastructures/memory-storage", () => {      cache = new MemoryStorage();      const got = cache.get("red"); -    expect(got).to.equal("apple"); +    expect(got).toEqual("apple");    });    it("stored cloned objects", () => { @@ -35,11 +34,11 @@ describe("background/infrastructures/memory-storage", () => {      recipe.salt = "20g";      const got = cache.get("recipe"); -    expect(got).to.deep.equal({ sugar: "300g", salt: "10g" }); +    expect(got).toEqual({ sugar: "300g", salt: "10g" });    });    it("throws an error with unserializable objects", () => {      const cache = new MemoryStorage(); -    expect(() => cache.set("fn", setTimeout)).to.throw(); +    expect(() => cache.set("fn", setTimeout)).toThrow();    });  }); | 
