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/repositories | |
parent | 11d6d725eee2ac0a1c16e4c7a4ce4f296bb6b016 (diff) |
Do not use chai on unit test
Diffstat (limited to 'test/background/repositories')
-rw-r--r-- | test/background/repositories/FindRepository.test.ts | 13 | ||||
-rw-r--r-- | test/background/repositories/Mark.test.ts | 11 | ||||
-rw-r--r-- | test/background/repositories/ReadyFrameRepository.test.ts | 13 |
3 files changed, 17 insertions, 20 deletions
diff --git a/test/background/repositories/FindRepository.test.ts b/test/background/repositories/FindRepository.test.ts index d8c9506..88d5e71 100644 --- a/test/background/repositories/FindRepository.test.ts +++ b/test/background/repositories/FindRepository.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import { FindRepositoryImpl } from "../../../src/background/repositories/FindRepository"; describe("background/repositories/FindRepositoryImpl", () => { @@ -10,18 +9,18 @@ describe("background/repositories/FindRepositoryImpl", () => { describe("global keyword", () => { it("get and set a keyword", async () => { - expect(await sut.getGlobalKeyword()).to.be.undefined; + expect(await sut.getGlobalKeyword()).toBeUndefined; await sut.setGlobalKeyword("Hello, world"); const keyword = await sut.getGlobalKeyword(); - expect(keyword).to.equal("Hello, world"); + expect(keyword).toEqual("Hello, world"); }); }); describe("local state", () => { it("get and set a keyword", async () => { - expect(await sut.getLocalState(10)).to.be.undefined; + expect(await sut.getLocalState(10)).toBeUndefined; await sut.setLocalState(10, { keyword: "Hello, world", @@ -29,10 +28,10 @@ describe("background/repositories/FindRepositoryImpl", () => { }); const state = await sut.getLocalState(10); - expect(state?.keyword).to.equal("Hello, world"); - expect(state?.frameId).to.equal(11); + expect(state?.keyword).toEqual("Hello, world"); + expect(state?.frameId).toEqual(11); - expect(await sut.getLocalState(20)).to.be.undefined; + expect(await sut.getLocalState(20)).toBeUndefined; }); }); }); diff --git a/test/background/repositories/Mark.test.ts b/test/background/repositories/Mark.test.ts index 3b054e5..bdee3b7 100644 --- a/test/background/repositories/Mark.test.ts +++ b/test/background/repositories/Mark.test.ts @@ -1,5 +1,4 @@ import MarkRepository from "../../../src/background/repositories/MarkRepository"; -import { expect } from "chai"; describe("background/repositories/mark", () => { let repository: MarkRepository; @@ -14,12 +13,12 @@ describe("background/repositories/mark", () => { await repository.setMark("A", mark); let got = (await repository.getMark("A"))!; - expect(got.tabId).to.equal(1); - expect(got.url).to.equal("http://example.com"); - expect(got.x).to.equal(10); - expect(got.y).to.equal(30); + expect(got.tabId).toEqual(1); + expect(got.url).toEqual("http://example.com"); + expect(got.x).toEqual(10); + expect(got.y).toEqual(30); got = (await repository.getMark("B"))!; - expect(got).to.be.undefined; + expect(got).toBeUndefined; }); }); diff --git a/test/background/repositories/ReadyFrameRepository.test.ts b/test/background/repositories/ReadyFrameRepository.test.ts index 71f20af..fb4d34a 100644 --- a/test/background/repositories/ReadyFrameRepository.test.ts +++ b/test/background/repositories/ReadyFrameRepository.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import { ReadyFrameRepositoryImpl } from "../../../src/background/repositories/ReadyFrameRepository"; describe("background/repositories/ReadyFrameRepositoryImpl", () => { @@ -9,7 +8,7 @@ describe("background/repositories/ReadyFrameRepositoryImpl", () => { }); it("get and set a keyword", async () => { - expect(await sut.getFrameIds(1)).to.be.undefined; + expect(await sut.getFrameIds(1)).toBeUndefined; await sut.addFrameId(1, 10); await sut.addFrameId(1, 12); @@ -18,16 +17,16 @@ describe("background/repositories/ReadyFrameRepositoryImpl", () => { await sut.addFrameId(2, 21); await sut.addFrameId(2, 21); - expect(await sut.getFrameIds(1)).to.deep.equal([10, 11, 12]); - expect(await sut.getFrameIds(2)).to.deep.equal([20, 21]); + expect(await sut.getFrameIds(1)).toEqual([10, 11, 12]); + expect(await sut.getFrameIds(2)).toEqual([20, 21]); await sut.removeFrameId(2, 21); - expect(await sut.getFrameIds(2)).to.deep.equal([20, 21]); + expect(await sut.getFrameIds(2)).toEqual([20, 21]); await sut.removeFrameId(2, 21); - expect(await sut.getFrameIds(2)).to.deep.equal([20]); + expect(await sut.getFrameIds(2)).toEqual([20]); await sut.removeFrameId(2, 20); - expect(await sut.getFrameIds(2)).to.be.undefined; + expect(await sut.getFrameIds(2)).toBeUndefined; }); }); |