diff options
Diffstat (limited to 'test/background/mock')
-rw-r--r-- | test/background/mock/MockFindClient.ts | 24 | ||||
-rw-r--r-- | test/background/mock/MockFindRepository.ts | 26 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/background/mock/MockFindClient.ts b/test/background/mock/MockFindClient.ts new file mode 100644 index 0000000..bd25a27 --- /dev/null +++ b/test/background/mock/MockFindClient.ts @@ -0,0 +1,24 @@ +import FindClient, { + FindResult, +} from "../../../src/background/clients/FindClient"; + +export default class MockFindClient implements FindClient { + highlightAll(): Promise<void> { + throw new Error("not implemented"); + } + + removeHighlights(): Promise<void> { + throw new Error("not implemented"); + } + + selectKeyword( + _tabId: number, + _rangeData: browser.find.RangeData + ): Promise<void> { + throw new Error("not implemented"); + } + + startFind(_keyword: string): Promise<FindResult> { + 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..af552c8 --- /dev/null +++ b/test/background/mock/MockFindRepository.ts @@ -0,0 +1,26 @@ +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(); + } +} |