aboutsummaryrefslogtreecommitdiff
path: root/test/content
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-04-15 19:35:15 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2020-05-02 12:55:42 +0900
commitb0fe06bc2e739cc252a559f666da65b27769959d (patch)
tree4fe9d1c6378b87082b14ca6d1b7ca2737df94aac /test/content
parent20d40d8017284f80876bde8e28cbde47c3651886 (diff)
Fix types in tests
Diffstat (limited to 'test/content')
-rw-r--r--test/content/InputDriver.test.ts2
-rw-r--r--test/content/presenters/Hint.test.ts10
-rw-r--r--test/content/presenters/NavigationPresenter.test.ts8
-rw-r--r--test/content/usecases/SettingUseCaase.test.ts4
4 files changed, 12 insertions, 12 deletions
diff --git a/test/content/InputDriver.test.ts b/test/content/InputDriver.test.ts
index bfada87..f464dac 100644
--- a/test/content/InputDriver.test.ts
+++ b/test/content/InputDriver.test.ts
@@ -16,8 +16,6 @@ describe("InputDriver", () => {
afterEach(() => {
target.remove();
- target = null;
- driver = null;
});
it("register callbacks", (done) => {
diff --git a/test/content/presenters/Hint.test.ts b/test/content/presenters/Hint.test.ts
index e64c39f..f961f88 100644
--- a/test/content/presenters/Hint.test.ts
+++ b/test/content/presenters/Hint.test.ts
@@ -13,17 +13,17 @@ describe("Hint", () => {
describe("#constructor", () => {
it("creates a hint element with tag name", () => {
- const link = document.getElementById("test-link");
+ const link = document.getElementById("test-link")!!;
new Hint(link, "abc");
const elem = document.querySelector(".vimvixen-hint");
- expect(elem.textContent.trim()).to.be.equal("abc");
+ expect(elem!!.textContent!!.trim()).to.be.equal("abc");
});
});
describe("#show", () => {
it("shows an element", () => {
- const link = document.getElementById("test-link");
+ const link = document.getElementById("test-link")!!;
const hint = new Hint(link, "abc");
hint.hide();
hint.show();
@@ -46,10 +46,10 @@ describe("Hint", () => {
describe("#remove", () => {
it("removes an element", () => {
- const link = document.getElementById("test-link");
+ const link = document.getElementById("test-link")!!;
const hint = new Hint(link, "abc");
- const elem = document.querySelector(".vimvixen-hint");
+ const elem = document.querySelector(".vimvixen-hint")!!;
expect(elem.parentElement).to.not.be.null;
hint.remove();
expect(elem.parentElement).to.be.null;
diff --git a/test/content/presenters/NavigationPresenter.test.ts b/test/content/presenters/NavigationPresenter.test.ts
index b362d8d..af3b487 100644
--- a/test/content/presenters/NavigationPresenter.test.ts
+++ b/test/content/presenters/NavigationPresenter.test.ts
@@ -4,7 +4,7 @@ import { expect } from "chai";
describe("NavigationPresenterImpl", () => {
let sut: NavigationPresenterImpl;
- const testRel = (done, rel, html) => {
+ const testRel = (done: () => void, rel: string, html: string) => {
const method =
rel === "prev" ? sut.openLinkPrev.bind(sut) : sut.openLinkNext.bind(sut);
document.body.innerHTML = html;
@@ -14,8 +14,10 @@ describe("NavigationPresenterImpl", () => {
done();
}, 0);
};
- const testPrev = (html) => (done) => testRel(done, "prev", html);
- const testNext = (html) => (done) => testRel(done, "next", html);
+ const testPrev = (html: string) => (done: () => void) =>
+ testRel(done, "prev", html);
+ const testNext = (html: string) => (done: () => void) =>
+ testRel(done, "next", html);
before(() => {
sut = new NavigationPresenterImpl();
diff --git a/test/content/usecases/SettingUseCaase.test.ts b/test/content/usecases/SettingUseCaase.test.ts
index 19a167a..1cc1e8a 100644
--- a/test/content/usecases/SettingUseCaase.test.ts
+++ b/test/content/usecases/SettingUseCaase.test.ts
@@ -40,7 +40,7 @@ describe("AddonEnabledUseCase", () => {
let sut: SettingUseCase;
beforeEach(() => {
- const testSettings = {
+ const testSettings = Settings.fromJSON({
keymaps: {},
search: {
default: "google",
@@ -54,7 +54,7 @@ describe("AddonEnabledUseCase", () => {
complete: "sbh",
},
blacklist: [],
- };
+ });
repository = new MockSettingRepository();
client = new MockSettingClient(testSettings);