diff options
Diffstat (limited to 'test/content/repositories')
9 files changed, 38 insertions, 60 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/FindRepository.test.ts b/test/content/repositories/FindRepository.test.ts deleted file mode 100644 index e0abb9d..0000000 --- a/test/content/repositories/FindRepository.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { FindRepositoryImpl } from "../../../src/content/repositories/FindRepository"; -import { expect } from "chai"; - -describe("FindRepositoryImpl", () => { - it("updates and gets last keyword", () => { - const sut = new FindRepositoryImpl(); - - expect(sut.getLastKeyword()).to.be.null; - - sut.setLastKeyword("monkey"); - - expect(sut.getLastKeyword()).to.equal("monkey"); - }); -}); diff --git a/test/content/repositories/FollowKeyRepository.test.ts b/test/content/repositories/FollowKeyRepository.test.ts index 6608662..fa35a54 100644 --- a/test/content/repositories/FollowKeyRepository.test.ts +++ b/test/content/repositories/FollowKeyRepository.test.ts @@ -1,29 +1,28 @@ import FollowKeyRepository, { FollowKeyRepositoryImpl, } from "../../../src/content/repositories/FollowKeyRepository"; -import { expect } from "chai"; describe("FollowKeyRepositoryImpl", () => { let sut: FollowKeyRepository; - before(() => { + beforeEach(() => { sut = new 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 9b5e151..6a7d0ac 100644 --- a/test/content/repositories/FollowMasterRepository.test.ts +++ b/test/content/repositories/FollowMasterRepository.test.ts @@ -1,26 +1,25 @@ import FollowMasterRepository, { FollowMasterRepositoryImpl, } from "../../../src/content/repositories/FollowMasterRepository"; -import { expect } from "chai"; describe("FollowMasterRepositoryImpl", () => { let sut: FollowMasterRepository; - before(() => { + beforeEach(() => { sut = new 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 0f829b2..52ed3fc 100644 --- a/test/content/repositories/FollowSlaveRepository.test.ts +++ b/test/content/repositories/FollowSlaveRepository.test.ts @@ -1,24 +1,23 @@ import FollowSlaveRepository, { FollowSlaveRepositoryImpl, } from "../../../src/content/repositories/FollowSlaveRepository"; -import { expect } from "chai"; describe("FollowSlaveRepository", () => { let sut: FollowSlaveRepository; - before(() => { + beforeEach(() => { sut = new FollowSlaveRepositoryImpl(); }); 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 0e01a73..715187b 100644 --- a/test/content/repositories/KeymapRepository.test.ts +++ b/test/content/repositories/KeymapRepository.test.ts @@ -1,13 +1,12 @@ import KeymapRepository, { KeymapRepositoryImpl, } from "../../../src/content/repositories/KeymapRepository"; -import { expect } from "chai"; import Key from "../../../src/shared/settings/Key"; describe("KeymapRepositoryImpl", () => { let sut: KeymapRepository; - before(() => { + beforeEach(() => { sut = new 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 473b4dc..a722a9c 100644 --- a/test/content/repositories/MarkKeyRepository.test.ts +++ b/test/content/repositories/MarkKeyRepository.test.ts @@ -1,36 +1,35 @@ import MarkRepository, { MarkKeyRepositoryImpl, } from "../../../src/content/repositories/MarkKeyRepository"; -import { expect } from "chai"; describe("MarkKeyRepositoryImpl", () => { let sut: MarkRepository; - before(() => { + beforeEach(() => { sut = new 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"); }); }); |