diff options
Diffstat (limited to 'test/background/mock/MockFindRepository.ts')
| -rw-r--r-- | test/background/mock/MockFindRepository.ts | 26 | 
1 files changed, 26 insertions, 0 deletions
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(); +  } +}  | 
