aboutsummaryrefslogtreecommitdiff
path: root/test/background/mock
diff options
context:
space:
mode:
Diffstat (limited to 'test/background/mock')
-rw-r--r--test/background/mock/MockFindClient.ts23
-rw-r--r--test/background/mock/MockFindRepository.ts31
-rw-r--r--test/background/mock/MockFramePresenter.ts7
-rw-r--r--test/background/mock/MockTabPresenter.ts4
4 files changed, 65 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/MockFramePresenter.ts b/test/background/mock/MockFramePresenter.ts
new file mode 100644
index 0000000..d688780
--- /dev/null
+++ b/test/background/mock/MockFramePresenter.ts
@@ -0,0 +1,7 @@
+import FramePresenter from "../../../src/background/presenters/FramePresenter";
+
+export default class MockFramePresenter implements FramePresenter {
+ getAllFrameIds(): Promise<number[]> {
+ 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");
+ }
}