aboutsummaryrefslogtreecommitdiff
path: root/test/background/mock/MockFindRepository.ts
blob: af552c8702e2f8f72d594adcbb65871a28e0034c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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();
  }
}