diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-07-29 22:29:40 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 22:29:40 +0900 |
commit | 5592b02a1500062628063862158116f382f3d8e2 (patch) | |
tree | 5c29d29a8fa1aa14f4f6407a66bcaf528c42555c /test/background/repositories | |
parent | 75236e9a41788f64df61b14a99e78aedc548e0ad (diff) | |
parent | 1160cf8aedf9810a76d84e3d99a72365e8aeae8a (diff) |
Merge pull request #1213 from ueokande/cross-frame-search
Cross frame search
Diffstat (limited to 'test/background/repositories')
-rw-r--r-- | test/background/repositories/FindRepository.test.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/background/repositories/FindRepository.test.ts b/test/background/repositories/FindRepository.test.ts new file mode 100644 index 0000000..a08dc6d --- /dev/null +++ b/test/background/repositories/FindRepository.test.ts @@ -0,0 +1,38 @@ +import { expect } from "chai"; +import { FindRepositoryImpl } from "../../../src/background/repositories/FindRepository"; + +describe("background/repositories/FindRepositoryImpl", () => { + let sut: FindRepositoryImpl; + + beforeEach(() => { + sut = new FindRepositoryImpl(); + }); + + describe("global keyword", () => { + it("get and set a keyword", async () => { + expect(await sut.getGlobalKeyword()).to.be.undefined; + + await sut.setGlobalKeyword("Hello, world"); + + const keyword = await sut.getGlobalKeyword(); + expect(keyword).to.equal("Hello, world"); + }); + }); + + describe("local state", () => { + it("get and set a keyword", async () => { + expect(await sut.getLocalState(10)).to.be.undefined; + + await sut.setLocalState(10, { + keyword: "Hello, world", + frameIds: [20, 21], + framePos: 0, + }); + + const state = await sut.getLocalState(10); + expect(state?.keyword).to.equal("Hello, world"); + + expect(await sut.getLocalState(20)).to.be.undefined; + }); + }); +}); |