aboutsummaryrefslogtreecommitdiff
path: root/test/background/mock/MockFindRepository.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-07-29 22:29:40 +0900
committerGitHub <noreply@github.com>2021-07-29 22:29:40 +0900
commit5592b02a1500062628063862158116f382f3d8e2 (patch)
tree5c29d29a8fa1aa14f4f6407a66bcaf528c42555c /test/background/mock/MockFindRepository.ts
parent75236e9a41788f64df61b14a99e78aedc548e0ad (diff)
parent1160cf8aedf9810a76d84e3d99a72365e8aeae8a (diff)
Merge pull request #1213 from ueokande/cross-frame-search
Cross frame search
Diffstat (limited to 'test/background/mock/MockFindRepository.ts')
-rw-r--r--test/background/mock/MockFindRepository.ts31
1 files changed, 31 insertions, 0 deletions
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();
+ }
+}