diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-26 14:15:33 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-26 16:12:58 +0900 |
commit | 84df6f233677a16f8a3f84b3eb7e77923da2c7fa (patch) | |
tree | fd397824d5295d4e38a6412d3faa1f06214a839b /test/content | |
parent | e1b4a2dc6763966628bc4a29838c48022cd5b4e5 (diff) |
Use jest API and fix some tests
Diffstat (limited to 'test/content')
9 files changed, 21 insertions, 23 deletions
diff --git a/test/content/presenters/Hint.test.ts b/test/content/presenters/Hint.test.ts index e9be2d5..0823bdc 100644 --- a/test/content/presenters/Hint.test.ts +++ b/test/content/presenters/Hint.test.ts @@ -108,7 +108,7 @@ describe("LinkHint", () => { describe("InputHint", () => { describe("#activate()", () => { - context("<input>", () => { + describe("<input>", () => { beforeEach(() => { document.body.innerHTML = `<input id='test-input'></input>`; }); @@ -122,7 +122,7 @@ describe("InputHint", () => { }); }); - context('<input type="checkbox">', () => { + describe('<input type="checkbox">', () => { beforeEach(() => { document.body.innerHTML = `<input type="checkbox" id='test-input'></input>`; }); @@ -135,7 +135,7 @@ describe("InputHint", () => { expect(input.checked).to.be.true; }); }); - context("<textarea>", () => { + describe("<textarea>", () => { beforeEach(() => { document.body.innerHTML = `<textarea id='test-textarea'></textarea>`; }); @@ -151,7 +151,7 @@ describe("InputHint", () => { }); }); - context("<button>", () => { + describe("<button>", () => { beforeEach(() => { document.body.innerHTML = `<button id='test-button'></button>`; }); diff --git a/test/content/presenters/NavigationPresenter.test.ts b/test/content/presenters/NavigationPresenter.test.ts index 74466ae..c377df4 100644 --- a/test/content/presenters/NavigationPresenter.test.ts +++ b/test/content/presenters/NavigationPresenter.test.ts @@ -5,9 +5,7 @@ import { NavigationPresenterImpl } from "../../../src/content/presenters/NavigationPresenter"; import { expect } from "chai"; -describe("NavigationPresenterImpl", function () { - this.timeout(5000); - +describe("NavigationPresenterImpl", () => { let sut: NavigationPresenterImpl; const testRel = (done: () => void, rel: string, html: string) => { @@ -25,7 +23,7 @@ describe("NavigationPresenterImpl", function () { const testNext = (html: string) => (done: () => void) => testRel(done, "next", html); - before(() => { + beforeEach(() => { sut = new NavigationPresenterImpl(); }); diff --git a/test/content/repositories/FollowKeyRepository.test.ts b/test/content/repositories/FollowKeyRepository.test.ts index 6608662..cf1d3d5 100644 --- a/test/content/repositories/FollowKeyRepository.test.ts +++ b/test/content/repositories/FollowKeyRepository.test.ts @@ -6,7 +6,7 @@ import { expect } from "chai"; describe("FollowKeyRepositoryImpl", () => { let sut: FollowKeyRepository; - before(() => { + beforeEach(() => { sut = new FollowKeyRepositoryImpl(); }); diff --git a/test/content/repositories/FollowMasterRepository.test.ts b/test/content/repositories/FollowMasterRepository.test.ts index 9b5e151..8e1d59e 100644 --- a/test/content/repositories/FollowMasterRepository.test.ts +++ b/test/content/repositories/FollowMasterRepository.test.ts @@ -6,7 +6,7 @@ import { expect } from "chai"; describe("FollowMasterRepositoryImpl", () => { let sut: FollowMasterRepository; - before(() => { + beforeEach(() => { sut = new FollowMasterRepositoryImpl(); }); diff --git a/test/content/repositories/FollowSlaveRepository.test.ts b/test/content/repositories/FollowSlaveRepository.test.ts index 0f829b2..c19513d 100644 --- a/test/content/repositories/FollowSlaveRepository.test.ts +++ b/test/content/repositories/FollowSlaveRepository.test.ts @@ -6,7 +6,7 @@ import { expect } from "chai"; describe("FollowSlaveRepository", () => { let sut: FollowSlaveRepository; - before(() => { + beforeEach(() => { sut = new FollowSlaveRepositoryImpl(); }); diff --git a/test/content/repositories/KeymapRepository.test.ts b/test/content/repositories/KeymapRepository.test.ts index 0e01a73..7321548 100644 --- a/test/content/repositories/KeymapRepository.test.ts +++ b/test/content/repositories/KeymapRepository.test.ts @@ -7,7 +7,7 @@ import Key from "../../../src/shared/settings/Key"; describe("KeymapRepositoryImpl", () => { let sut: KeymapRepository; - before(() => { + beforeEach(() => { sut = new KeymapRepositoryImpl(); }); diff --git a/test/content/repositories/MarkKeyRepository.test.ts b/test/content/repositories/MarkKeyRepository.test.ts index 473b4dc..317bbaa 100644 --- a/test/content/repositories/MarkKeyRepository.test.ts +++ b/test/content/repositories/MarkKeyRepository.test.ts @@ -6,7 +6,7 @@ import { expect } from "chai"; describe("MarkKeyRepositoryImpl", () => { let sut: MarkRepository; - before(() => { + beforeEach(() => { sut = new MarkKeyRepositoryImpl(); }); diff --git a/test/content/usecases/AddonEnabledUseCase.test.ts b/test/content/usecases/AddonEnabledUseCase.test.ts index 8a614c5..ee5f1cd 100644 --- a/test/content/usecases/AddonEnabledUseCase.test.ts +++ b/test/content/usecases/AddonEnabledUseCase.test.ts @@ -56,7 +56,7 @@ describe("AddonEnabledUseCase", () => { }); }); - describe("#disable", async () => { + describe("#disable", () => { it("store and indicate as disabled", async () => { await sut.disable(); diff --git a/test/content/usecases/KeymapUseCase.test.ts b/test/content/usecases/KeymapUseCase.test.ts index 24ac6d8..22b09ac 100644 --- a/test/content/usecases/KeymapUseCase.test.ts +++ b/test/content/usecases/KeymapUseCase.test.ts @@ -41,7 +41,7 @@ class MockAddressRepository implements AddressRepository { } describe("KeymapUseCase", () => { - context("with no-digis keymaps", () => { + describe("with no-digis keymaps", () => { const settings = Settings.fromJSON({ keymaps: { k: { type: "scroll.vertically", count: -1 }, @@ -52,7 +52,7 @@ describe("KeymapUseCase", () => { let sut: KeymapUseCase; - before(() => { + beforeEach(() => { sut = new KeymapUseCase( new KeymapRepositoryImpl(), new MockSettingRepository(settings), @@ -89,7 +89,7 @@ describe("KeymapUseCase", () => { }); }); - context("when keymaps containing numeric mappings", () => { + describe("when keymaps containing numeric mappings", () => { const settings = Settings.fromJSON({ keymaps: { 20: { type: "scroll.top" }, @@ -99,7 +99,7 @@ describe("KeymapUseCase", () => { let sut: KeymapUseCase; - before(() => { + beforeEach(() => { sut = new KeymapUseCase( new KeymapRepositoryImpl(), new MockSettingRepository(settings), @@ -145,7 +145,7 @@ describe("KeymapUseCase", () => { }); }); - context("when the keys are mismatched with the operations", () => { + describe("when the keys are mismatched with the operations", () => { const settings = Settings.fromJSON({ keymaps: { gg: { type: "scroll.top" }, @@ -155,7 +155,7 @@ describe("KeymapUseCase", () => { let sut: KeymapUseCase; - before(() => { + beforeEach(() => { sut = new KeymapUseCase( new KeymapRepositoryImpl(), new MockSettingRepository(settings), @@ -189,7 +189,7 @@ describe("KeymapUseCase", () => { }); }); - context("when the site matches to the blacklist", () => { + describe("when the site matches to the blacklist", () => { const settings = Settings.fromJSON({ keymaps: { k: { type: "scroll.vertically", count: -1 }, @@ -200,7 +200,7 @@ describe("KeymapUseCase", () => { let sut: KeymapUseCase; - before(() => { + beforeEach(() => { sut = new KeymapUseCase( new KeymapRepositoryImpl(), new MockSettingRepository(settings), @@ -222,7 +222,7 @@ describe("KeymapUseCase", () => { }); }); - context("when the site matches to the partial blacklist", () => { + describe("when the site matches to the partial blacklist", () => { const settings = Settings.fromJSON({ keymaps: { k: { type: "scroll.vertically", count: -1 }, |