Use TSyringe on content script

This commit is contained in:
Shin'ya Ueoka 2019-05-20 22:21:31 +09:00
parent 71f3a1ea2d
commit 1666e626b0
35 changed files with 398 additions and 433 deletions

View file

@ -40,7 +40,7 @@ describe('AddonEnabledUseCase', () => {
beforeEach(() => {
repository = new MockAddonEnabledRepository(true);
indicator = new MockAddonIndicatorClient(false);
sut = new AddonEnabledUseCase({ repository, indicator });
sut = new AddonEnabledUseCase(indicator, repository);
});
describe('#enable', () => {

View file

@ -1,4 +1,5 @@
import ClipboardRepository from '../../../src/content/repositories/ClipboardRepository';
import { SettingRepositoryImpl } from '../../../src/content/repositories/SettingRepository';
import TabsClient from '../../../src/content/client/TabsClient';
import MockConsoleClient from '../mock/MockConsoleClient';
import ClipboardUseCase from '../../../src/content/usecases/ClipboardUseCase';
@ -43,7 +44,12 @@ describe('ClipboardUseCase', () => {
repository = new MockClipboardRepository();
client = new MockTabsClient();
consoleClient = new MockConsoleClient();
sut = new ClipboardUseCase({ repository, client: client, consoleClient });
sut = new ClipboardUseCase(
repository,
new SettingRepositoryImpl(),
client,
consoleClient
);
});
describe('#yankCurrentURL', () => {

View file

@ -71,7 +71,7 @@ describe('FindUseCase', () => {
presenter = new MockFindPresenter();
client = new MockFindClient();
consoleClient = new MockConsoleClient();
sut = new FindUseCase({ repository, presenter, client, consoleClient });
sut = new FindUseCase(presenter, repository, client, consoleClient);
});
describe('#startFind', () => {

View file

@ -1,4 +1,5 @@
import MarkRepository from '../../../src/content/repositories/MarkRepository';
import { SettingRepositoryImpl } from '../../../src/content/repositories/SettingRepository';
import MarkUseCase from '../../../src/content/usecases/MarkUseCase';
import MarkClient from '../../../src/content/client/MarkClient';
import MockConsoleClient from '../mock/MockConsoleClient';
@ -54,9 +55,13 @@ describe('MarkUseCase', () => {
client = new MockMarkClient();
consoleClient = new MockConsoleClient();
scrollPresenter = new MockScrollPresenter();
sut = new MarkUseCase({
repository, client, consoleClient, scrollPresenter,
});
sut = new MarkUseCase(
scrollPresenter,
client,
repository,
new SettingRepositoryImpl(),
consoleClient,
);
});
describe('#set', () => {

View file

@ -56,7 +56,7 @@ describe('AddonEnabledUseCase', () => {
repository = new MockSettingRepository();
client = new MockSettingClient(testSettings);
sut = new SettingUseCase({ repository, client });
sut = new SettingUseCase(repository, client);
});
describe('#reload', () => {