aboutsummaryrefslogtreecommitdiff
path: root/test/background/repositories
diff options
context:
space:
mode:
Diffstat (limited to 'test/background/repositories')
-rw-r--r--test/background/repositories/FindRepository.test.ts4
-rw-r--r--test/background/repositories/ReadyFrameRepository.test.ts33
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;
+ });
+});