aboutsummaryrefslogtreecommitdiff
path: root/test/content
diff options
context:
space:
mode:
Diffstat (limited to 'test/content')
-rw-r--r--test/content/InputDriver.test.ts2
-rw-r--r--test/content/presenters/Hint.test.ts2
-rw-r--r--test/content/presenters/NavigationPresenter.test.ts7
-rw-r--r--test/content/repositories/KeymapRepository.test.ts10
-rw-r--r--test/content/usecases/ClipboardUseCase.test.ts20
5 files changed, 26 insertions, 15 deletions
diff --git a/test/content/InputDriver.test.ts b/test/content/InputDriver.test.ts
index 367ec1d..d3a55dd 100644
--- a/test/content/InputDriver.test.ts
+++ b/test/content/InputDriver.test.ts
@@ -104,7 +104,7 @@ describe('InputDriver', () => {
['input', 'textarea', 'select'].forEach((name) => {
const input = window.document.createElement(name);
const driver = new InputDriver(input);
- driver.onKey((key: Key): boolean => {
+ driver.onKey((_key: Key): boolean => {
expect.fail();
return false;
});
diff --git a/test/content/presenters/Hint.test.ts b/test/content/presenters/Hint.test.ts
index 708ddaa..7daa63d 100644
--- a/test/content/presenters/Hint.test.ts
+++ b/test/content/presenters/Hint.test.ts
@@ -12,7 +12,7 @@ describe('Hint', () => {
describe('#constructor', () => {
it('creates a hint element with tag name', () => {
const link = document.getElementById('test-link');
- const hint = new Hint(link, 'abc');
+ new Hint(link, 'abc');
const elem = document.querySelector('.vimvixen-hint');
expect(elem.textContent.trim()).to.be.equal('abc');
diff --git a/test/content/presenters/NavigationPresenter.test.ts b/test/content/presenters/NavigationPresenter.test.ts
index 5b6a8ca..6aa057b 100644
--- a/test/content/presenters/NavigationPresenter.test.ts
+++ b/test/content/presenters/NavigationPresenter.test.ts
@@ -1,9 +1,8 @@
-import NavigationPresenter, { NavigationPresenterImpl }
- from '../../../src/content/presenters/NavigationPresenter';
+import { NavigationPresenterImpl } from '../../../src/content/presenters/NavigationPresenter';
import { expect } from 'chai';
-describe('NavigationPresenter', () => {
- let sut;
+describe('NavigationPresenterImpl', () => {
+ let sut: NavigationPresenterImpl;
const testRel = (done, rel, html) => {
const method = rel === 'prev' ? sut.openLinkPrev.bind(sut) : sut.openLinkNext.bind(sut);
diff --git a/test/content/repositories/KeymapRepository.test.ts b/test/content/repositories/KeymapRepository.test.ts
index df013df..68f515c 100644
--- a/test/content/repositories/KeymapRepository.test.ts
+++ b/test/content/repositories/KeymapRepository.test.ts
@@ -12,11 +12,11 @@ describe('KeymapRepositoryImpl', () => {
describe('#enqueueKey()', () => {
it('enqueues keys', () => {
- sut.enqueueKey(Key.fromMapKey('a');
- sut.enqueueKey(Key.fromMapKey('b');
- let sequence = sut.enqueueKey(Key.fromMapKey('c'));
+ sut.enqueueKey(Key.fromMapKey('a'));
+ sut.enqueueKey(Key.fromMapKey('b'));
+ const sequence = sut.enqueueKey(Key.fromMapKey('c'));
- let keys = sequence.keys;
+ 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;
@@ -30,7 +30,7 @@ describe('KeymapRepositoryImpl', () => {
sut.enqueueKey(Key.fromMapKey('c'));
sut.clear();
- let sequence = sut.enqueueKey(Key.fromMapKey('a'));
+ const sequence = sut.enqueueKey(Key.fromMapKey('a'));
expect(sequence.length()).to.equal(1);
});
});
diff --git a/test/content/usecases/ClipboardUseCase.test.ts b/test/content/usecases/ClipboardUseCase.test.ts
index 2e711c6..3cc82fe 100644
--- a/test/content/usecases/ClipboardUseCase.test.ts
+++ b/test/content/usecases/ClipboardUseCase.test.ts
@@ -6,19 +6,31 @@ import ConsoleClient from '../../../src/content/client/ConsoleClient';
import * as sinon from 'sinon';
import { expect } from 'chai';
+import {Operation} from "../../../src/shared/operations";
describe('ClipboardUseCase', () => {
let clipboardRepository: ClipboardRepository;
+
let operationClient: OperationClient;
+
let consoleClient: ConsoleClient;
+
let sut: ClipboardUseCase;
beforeEach(() => {
- const modal = <ConsoleClient>{};
+ clipboardRepository = new class implements ClipboardRepository {
+ read(): string { return ""; }
+ write(_text: string) {}
+ };
+ operationClient = new class implements OperationClient {
+ execBackgroundOp(_repeat: number, _op: Operation): Promise<void> { return Promise.resolve() }
+ internalOpenUrl(_url: string, _newTab?: boolean, _background?: boolean): Promise<void> { return Promise.resolve() }
+ };
+ consoleClient = new class implements ConsoleClient {
+ error(_text: string): Promise<void> { return Promise.resolve() }
+ info(_text: string): Promise<void> { return Promise.resolve() }
+ };
- clipboardRepository = <ClipboardRepository>{ read() {}, write(_) {} };
- operationClient = <OperationClient>{ internalOpenUrl(_) {} };
- consoleClient = <ConsoleClient>{ info(_) {}};
sut = new ClipboardUseCase(
clipboardRepository,
new SettingRepositoryImpl(),