diff options
Diffstat (limited to 'test/content/repositories')
8 files changed, 33 insertions, 41 deletions
diff --git a/test/content/repositories/AddonEnabledRepository.test.ts b/test/content/repositories/AddonEnabledRepository.test.ts index 13dff76..692407c 100644 --- a/test/content/repositories/AddonEnabledRepository.test.ts +++ b/test/content/repositories/AddonEnabledRepository.test.ts @@ -1,14 +1,13 @@ import { AddonEnabledRepositoryImpl } from "../../../src/content/repositories/AddonEnabledRepository"; -import { expect } from "chai"; describe("AddonEnabledRepositoryImpl", () => { it("updates and gets current value", () => { const sut = new AddonEnabledRepositoryImpl(); sut.set(true); - expect(sut.get()).to.be.true; + expect(sut.get()).toBeTruthy; sut.set(false); - expect(sut.get()).to.be.false; + expect(sut.get()).toBeFalsy; }); }); diff --git a/test/content/repositories/FollowKeyRepository.test.ts b/test/content/repositories/FollowKeyRepository.test.ts index cf1d3d5..fa35a54 100644 --- a/test/content/repositories/FollowKeyRepository.test.ts +++ b/test/content/repositories/FollowKeyRepository.test.ts @@ -1,7 +1,6 @@ import FollowKeyRepository, { FollowKeyRepositoryImpl, } from "../../../src/content/repositories/FollowKeyRepository"; -import { expect } from "chai"; describe("FollowKeyRepositoryImpl", () => { let sut: FollowKeyRepository; @@ -12,18 +11,18 @@ describe("FollowKeyRepositoryImpl", () => { describe("#getKeys()/#pushKey()/#popKey()", () => { it("enqueues keys", () => { - expect(sut.getKeys()).to.be.empty; + expect(sut.getKeys()).toHaveLength(0); sut.pushKey("a"); sut.pushKey("b"); sut.pushKey("c"); - expect(sut.getKeys()).to.deep.equal(["a", "b", "c"]); + expect(sut.getKeys()).toEqual(["a", "b", "c"]); sut.popKey(); - expect(sut.getKeys()).to.deep.equal(["a", "b"]); + expect(sut.getKeys()).toEqual(["a", "b"]); sut.clearKeys(); - expect(sut.getKeys()).to.be.empty; + expect(sut.getKeys()).toHaveLength(0); }); }); }); diff --git a/test/content/repositories/FollowMasterRepository.test.ts b/test/content/repositories/FollowMasterRepository.test.ts index 8e1d59e..6a7d0ac 100644 --- a/test/content/repositories/FollowMasterRepository.test.ts +++ b/test/content/repositories/FollowMasterRepository.test.ts @@ -1,7 +1,6 @@ import FollowMasterRepository, { FollowMasterRepositoryImpl, } from "../../../src/content/repositories/FollowMasterRepository"; -import { expect } from "chai"; describe("FollowMasterRepositoryImpl", () => { let sut: FollowMasterRepository; @@ -12,15 +11,15 @@ describe("FollowMasterRepositoryImpl", () => { describe("#getTags()/#addTag()/#clearTags()", () => { it("gets, adds and clears tags", () => { - expect(sut.getTags()).to.be.empty; + expect(sut.getTags()).toHaveLength(0); sut.addTag("a"); sut.addTag("b"); sut.addTag("c"); - expect(sut.getTags()).to.deep.equal(["a", "b", "c"]); + expect(sut.getTags()).toEqual(["a", "b", "c"]); sut.clearTags(); - expect(sut.getTags()).to.be.empty; + expect(sut.getTags()).toHaveLength(0); }); }); @@ -29,22 +28,22 @@ describe("FollowMasterRepositoryImpl", () => { for (const tag of ["a", "aa", "ab", "b", "ba", "bb"]) { sut.addTag(tag); } - expect(sut.getTagsByPrefix("a")).to.deep.equal(["a", "aa", "ab"]); - expect(sut.getTagsByPrefix("aa")).to.deep.equal(["aa"]); - expect(sut.getTagsByPrefix("b")).to.deep.equal(["b", "ba", "bb"]); - expect(sut.getTagsByPrefix("c")).to.be.empty; + expect(sut.getTagsByPrefix("a")).toEqual(["a", "aa", "ab"]); + expect(sut.getTagsByPrefix("aa")).toEqual(["aa"]); + expect(sut.getTagsByPrefix("b")).toEqual(["b", "ba", "bb"]); + expect(sut.getTagsByPrefix("c")).toHaveLength(0); }); }); describe("#setCurrentFollowMode()/#getCurrentNewTabMode()/#getCurrentBackgroundMode", () => { it("updates and gets follow mode", () => { sut.setCurrentFollowMode(false, true); - expect(sut.getCurrentNewTabMode()).to.be.false; - expect(sut.getCurrentBackgroundMode()).to.be.true; + expect(sut.getCurrentNewTabMode()).toBeFalsy; + expect(sut.getCurrentBackgroundMode()).toBeTruthy; sut.setCurrentFollowMode(true, false); - expect(sut.getCurrentNewTabMode()).to.be.true; - expect(sut.getCurrentBackgroundMode()).to.be.false; + expect(sut.getCurrentNewTabMode()).toBeTruthy; + expect(sut.getCurrentBackgroundMode()).toBeFalsy; }); }); }); diff --git a/test/content/repositories/FollowSlaveRepository.test.ts b/test/content/repositories/FollowSlaveRepository.test.ts index c19513d..52ed3fc 100644 --- a/test/content/repositories/FollowSlaveRepository.test.ts +++ b/test/content/repositories/FollowSlaveRepository.test.ts @@ -1,7 +1,6 @@ import FollowSlaveRepository, { FollowSlaveRepositoryImpl, } from "../../../src/content/repositories/FollowSlaveRepository"; -import { expect } from "chai"; describe("FollowSlaveRepository", () => { let sut: FollowSlaveRepository; @@ -12,13 +11,13 @@ describe("FollowSlaveRepository", () => { describe("#isFollowMode()/#enableFollowMode()/#disableFollowMode()", () => { it("gets, adds updates follow mode", () => { - expect(sut.isFollowMode()).to.be.false; + expect(sut.isFollowMode()).toBeFalsy; sut.enableFollowMode(); - expect(sut.isFollowMode()).to.be.true; + expect(sut.isFollowMode()).toBeTruthy; sut.disableFollowMode(); - expect(sut.isFollowMode()).to.be.false; + expect(sut.isFollowMode()).toBeFalsy; }); }); }); diff --git a/test/content/repositories/KeymapRepository.test.ts b/test/content/repositories/KeymapRepository.test.ts index 7321548..715187b 100644 --- a/test/content/repositories/KeymapRepository.test.ts +++ b/test/content/repositories/KeymapRepository.test.ts @@ -1,7 +1,6 @@ import KeymapRepository, { KeymapRepositoryImpl, } from "../../../src/content/repositories/KeymapRepository"; -import { expect } from "chai"; import Key from "../../../src/shared/settings/Key"; describe("KeymapRepositoryImpl", () => { @@ -18,9 +17,9 @@ describe("KeymapRepositoryImpl", () => { const sequence = sut.enqueueKey(Key.fromMapKey("c")); const keys = sequence.keys; - expect(keys[0].equals(Key.fromMapKey("a"))).to.be.true; - expect(keys[1].equals(Key.fromMapKey("b"))).to.be.true; - expect(keys[2].equals(Key.fromMapKey("c"))).to.be.true; + expect(keys[0].equals(Key.fromMapKey("a"))).toBeTruthy; + expect(keys[1].equals(Key.fromMapKey("b"))).toBeTruthy; + expect(keys[2].equals(Key.fromMapKey("c"))).toBeTruthy; }); }); @@ -32,7 +31,7 @@ describe("KeymapRepositoryImpl", () => { sut.clear(); const sequence = sut.enqueueKey(Key.fromMapKey("a")); - expect(sequence.length()).to.equal(1); + expect(sequence.length()).toEqual(1); }); }); }); diff --git a/test/content/repositories/MarkKeyRepository.test.ts b/test/content/repositories/MarkKeyRepository.test.ts index 317bbaa..a722a9c 100644 --- a/test/content/repositories/MarkKeyRepository.test.ts +++ b/test/content/repositories/MarkKeyRepository.test.ts @@ -1,7 +1,6 @@ import MarkRepository, { MarkKeyRepositoryImpl, } from "../../../src/content/repositories/MarkKeyRepository"; -import { expect } from "chai"; describe("MarkKeyRepositoryImpl", () => { let sut: MarkRepository; @@ -12,25 +11,25 @@ describe("MarkKeyRepositoryImpl", () => { describe("#isSetMode/#enableSetMode/#disabeSetMode", () => { it("enables and disables set mode", () => { - expect(sut.isSetMode()).to.be.false; + expect(sut.isSetMode()).toBeFalsy; sut.enableSetMode(); - expect(sut.isSetMode()).to.be.true; + expect(sut.isSetMode()).toBeTruthy; sut.disabeSetMode(); - expect(sut.isSetMode()).to.be.false; + expect(sut.isSetMode()).toBeFalsy; }); }); describe("#isJumpMode/#enableJumpMode/#disabeJumpMode", () => { it("enables and disables jump mode", () => { - expect(sut.isJumpMode()).to.be.false; + expect(sut.isJumpMode()).toBeFalsy; sut.enableJumpMode(); - expect(sut.isJumpMode()).to.be.true; + expect(sut.isJumpMode()).toBeTruthy; sut.disabeJumpMode(); - expect(sut.isJumpMode()).to.be.false; + expect(sut.isJumpMode()).toBeFalsy; }); }); }); diff --git a/test/content/repositories/MarkRepository.test.ts b/test/content/repositories/MarkRepository.test.ts index f2a7326..b4486a1 100644 --- a/test/content/repositories/MarkRepository.test.ts +++ b/test/content/repositories/MarkRepository.test.ts @@ -1,12 +1,11 @@ import { MarkRepositoryImpl } from "../../../src/content/repositories/MarkRepository"; -import { expect } from "chai"; describe("MarkRepositoryImpl", () => { it("save and load marks", () => { const sut = new MarkRepositoryImpl(); sut.set("a", { x: 10, y: 20 }); - expect(sut.get("a")).to.deep.equal({ x: 10, y: 20 }); - expect(sut.get("b")).to.be.null; + expect(sut.get("a")).toEqual({ x: 10, y: 20 }); + expect(sut.get("b")).toBeNull; }); }); diff --git a/test/content/repositories/SettingRepository.test.ts b/test/content/repositories/SettingRepository.test.ts index 99247a9..409012a 100644 --- a/test/content/repositories/SettingRepository.test.ts +++ b/test/content/repositories/SettingRepository.test.ts @@ -1,5 +1,4 @@ import { SettingRepositoryImpl } from "../../../src/content/repositories/SettingRepository"; -import { expect } from "chai"; import Settings from "../../../src/shared/settings/Settings"; describe("SettingRepositoryImpl", () => { @@ -25,6 +24,6 @@ describe("SettingRepositoryImpl", () => { sut.set(settings); const actual = sut.get(); - expect(actual.properties.hintchars).to.equal("abcd1234"); + expect(actual.properties.hintchars).toEqual("abcd1234"); }); }); |