diff options
Diffstat (limited to 'test/background/mock')
-rw-r--r-- | test/background/mock/MockFindClient.ts | 23 | ||||
-rw-r--r-- | test/background/mock/MockFindRepository.ts | 31 | ||||
-rw-r--r-- | test/background/mock/MockReadyFrameRepository.ts | 15 | ||||
-rw-r--r-- | test/background/mock/MockTabPresenter.ts | 4 |
4 files changed, 73 insertions, 0 deletions
diff --git a/test/background/mock/MockFindClient.ts b/test/background/mock/MockFindClient.ts new file mode 100644 index 0000000..dd6d8f3 --- /dev/null +++ b/test/background/mock/MockFindClient.ts @@ -0,0 +1,23 @@ +import FindClient from "../../../src/background/clients/FindClient"; + +export default class MockFindClient implements FindClient { + findNext( + _tabId: number, + _frameId: number, + _keyword: string + ): Promise<boolean> { + throw new Error("not implemented"); + } + + findPrev( + _tabId: number, + _frameId: number, + _keyword: string + ): Promise<boolean> { + throw new Error("not implemented"); + } + + clearSelection(_tabId: number, _frameId: number): Promise<void> { + throw new Error("not implemented"); + } +} diff --git a/test/background/mock/MockFindRepository.ts b/test/background/mock/MockFindRepository.ts new file mode 100644 index 0000000..d5151f8 --- /dev/null +++ b/test/background/mock/MockFindRepository.ts @@ -0,0 +1,31 @@ +import FindRepository, { + FindState, +} from "../../../src/background/repositories/FindRepository"; + +export default class MockFindRepository implements FindRepository { + private globalKeyword: string | undefined; + private localStates: { [tabId: number]: FindState } = {}; + + getGlobalKeyword(): Promise<string | undefined> { + return Promise.resolve(this.globalKeyword); + } + + setGlobalKeyword(keyword: string): Promise<void> { + this.globalKeyword = keyword; + return Promise.resolve(); + } + + getLocalState(tabId: number): Promise<FindState | undefined> { + return Promise.resolve(this.localStates[tabId]); + } + + setLocalState(tabId: number, state: FindState): Promise<void> { + this.localStates[tabId] = state; + return Promise.resolve(); + } + + deleteLocalState(tabId: number): Promise<void> { + delete this.localStates[tabId]; + return Promise.resolve(); + } +} diff --git a/test/background/mock/MockReadyFrameRepository.ts b/test/background/mock/MockReadyFrameRepository.ts new file mode 100644 index 0000000..4a5ec52 --- /dev/null +++ b/test/background/mock/MockReadyFrameRepository.ts @@ -0,0 +1,15 @@ +import ReadyFrameRepository from "../../../src/background/repositories/ReadyFrameRepository"; + +export default class MockReadyFrameRepository implements ReadyFrameRepository { + addFrameId(_tabId: number, _fraemId: number): Promise<void> { + throw new Error("not implemented"); + } + + removeFrameId(_tabId: number, _frameId: number): Promise<void> { + throw new Error("not implemented"); + } + + getFrameIds(_tabId: number): Promise<number[] | undefined> { + throw new Error("not implemented"); + } +} diff --git a/test/background/mock/MockTabPresenter.ts b/test/background/mock/MockTabPresenter.ts index 22fb947..0968e44 100644 --- a/test/background/mock/MockTabPresenter.ts +++ b/test/background/mock/MockTabPresenter.ts @@ -176,4 +176,8 @@ export default class MockTabPresenter implements TabPresenter { this.zooms[index] = factor; return Promise.resolve(); } + + toggleReaderMode(_tabId: number): Promise<void> { + throw new Error("not implemented"); + } } |