diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-26 11:54:11 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 11:54:11 +0900 |
commit | 9154972485c24a5a90782cef17f75b3a79a13774 (patch) | |
tree | 4bc3d608f498176f50a74ca7fc03d2d501ac7920 /test/background/repositories | |
parent | cbf4b37bd0d5ba277d6400ed460d6a086ae1d7bb (diff) | |
parent | 91d4712e676782bb58fd7eb03fdc1f85111fca04 (diff) |
Merge pull request #1264 from ueokande/fix-establish-connection-issue
Search a content from frames successfully loaded
Diffstat (limited to 'test/background/repositories')
-rw-r--r-- | test/background/repositories/FindRepository.test.ts | 4 | ||||
-rw-r--r-- | test/background/repositories/ReadyFrameRepository.test.ts | 33 |
2 files changed, 35 insertions, 2 deletions
diff --git a/test/background/repositories/FindRepository.test.ts b/test/background/repositories/FindRepository.test.ts index a08dc6d..d8c9506 100644 --- a/test/background/repositories/FindRepository.test.ts +++ b/test/background/repositories/FindRepository.test.ts @@ -25,12 +25,12 @@ describe("background/repositories/FindRepositoryImpl", () => { await sut.setLocalState(10, { keyword: "Hello, world", - frameIds: [20, 21], - framePos: 0, + frameId: 11, }); const state = await sut.getLocalState(10); expect(state?.keyword).to.equal("Hello, world"); + expect(state?.frameId).to.equal(11); expect(await sut.getLocalState(20)).to.be.undefined; }); diff --git a/test/background/repositories/ReadyFrameRepository.test.ts b/test/background/repositories/ReadyFrameRepository.test.ts new file mode 100644 index 0000000..71f20af --- /dev/null +++ b/test/background/repositories/ReadyFrameRepository.test.ts @@ -0,0 +1,33 @@ +import { expect } from "chai"; +import { ReadyFrameRepositoryImpl } from "../../../src/background/repositories/ReadyFrameRepository"; + +describe("background/repositories/ReadyFrameRepositoryImpl", () => { + let sut: ReadyFrameRepositoryImpl; + + beforeEach(() => { + sut = new ReadyFrameRepositoryImpl(); + }); + + it("get and set a keyword", async () => { + expect(await sut.getFrameIds(1)).to.be.undefined; + + await sut.addFrameId(1, 10); + await sut.addFrameId(1, 12); + await sut.addFrameId(1, 11); + await sut.addFrameId(2, 20); + await sut.addFrameId(2, 21); + await sut.addFrameId(2, 21); + + expect(await sut.getFrameIds(1)).to.deep.equal([10, 11, 12]); + expect(await sut.getFrameIds(2)).to.deep.equal([20, 21]); + + await sut.removeFrameId(2, 21); + expect(await sut.getFrameIds(2)).to.deep.equal([20, 21]); + + await sut.removeFrameId(2, 21); + expect(await sut.getFrameIds(2)).to.deep.equal([20]); + + await sut.removeFrameId(2, 20); + expect(await sut.getFrameIds(2)).to.be.undefined; + }); +}); |