diff options
Diffstat (limited to 'test/background/operators/impls/FindNextOperator.test.ts')
-rw-r--r-- | test/background/operators/impls/FindNextOperator.test.ts | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/test/background/operators/impls/FindNextOperator.test.ts b/test/background/operators/impls/FindNextOperator.test.ts index 0bee3f5..7509ef4 100644 --- a/test/background/operators/impls/FindNextOperator.test.ts +++ b/test/background/operators/impls/FindNextOperator.test.ts @@ -4,7 +4,7 @@ import FindNextOperator from "../../../../src/background/operators/impls/FindNex import MockFindRepository from "../../mock/MockFindRepository"; import MockFindClient from "../../mock/MockFindClient"; import MockConsoleClient from "../../mock/MockConsoleClient"; -import MockFramePresenter from "../../mock/MockFramePresenter"; +import MockReadyFrameRepository from "../../mock/MockReadyFrameRepository"; describe("FindNextOperator", () => { const keyword = "hello"; @@ -14,13 +14,13 @@ describe("FindNextOperator", () => { const findRepository = new MockFindRepository(); const findClient = new MockFindClient(); const consoleClient = new MockConsoleClient(); - const framePresenter = new MockFramePresenter(); + const frameRepository = new MockReadyFrameRepository(); const sut = new FindNextOperator( tabPresenter, findRepository, findClient, consoleClient, - framePresenter + frameRepository ); let currentTabId: number; @@ -32,6 +32,10 @@ describe("FindNextOperator", () => { active: true, }); currentTabId = currentTab.id!; + + sinon + .stub(frameRepository, "getFrameIds") + .returns(Promise.resolve(frameIds)); }); describe("#run", () => { @@ -54,8 +58,7 @@ describe("FindNextOperator", () => { sinon.stub(findRepository, "getLocalState").returns( Promise.resolve({ keyword, - frameIds, - framePos: 1, + frameId: 100, }) ); @@ -68,7 +71,7 @@ describe("FindNextOperator", () => { const mockFindRepository = sinon.mock(findRepository); mockFindRepository .expects("setLocalState") - .withArgs(currentTabId, { keyword, frameIds, framePos: 1 }); + .withArgs(currentTabId, { keyword, frameId: 100 }); await sut.run(); @@ -80,8 +83,7 @@ describe("FindNextOperator", () => { sinon.stub(findRepository, "getLocalState").returns( Promise.resolve({ keyword, - frameIds, - framePos: 1, + frameId: 100, }) ); @@ -102,7 +104,7 @@ describe("FindNextOperator", () => { const mockFindRepository = sinon.mock(findRepository); mockFindRepository .expects("setLocalState") - .withArgs(currentTabId, { keyword, frameIds, framePos: 2 }); + .withArgs(currentTabId, { keyword, frameId: 101 }); await sut.run(); @@ -114,8 +116,7 @@ describe("FindNextOperator", () => { sinon.stub(findRepository, "getLocalState").returns( Promise.resolve({ keyword, - frameIds, - framePos: 2, + frameId: 101, }) ); @@ -136,7 +137,7 @@ describe("FindNextOperator", () => { const mockFindRepository = sinon.mock(findRepository); mockFindRepository .expects("setLocalState") - .withArgs(currentTabId, { keyword, frameIds, framePos: 0 }); + .withArgs(currentTabId, { keyword, frameId: 0 }); await sut.run(); @@ -151,9 +152,6 @@ describe("FindNextOperator", () => { sinon .stub(findRepository, "getGlobalKeyword") .returns(Promise.resolve(keyword)); - sinon - .stub(framePresenter, "getAllFrameIds") - .returns(Promise.resolve(frameIds)); sinon.stub(consoleClient, "showInfo").returns(Promise.resolve()); const mockFindClient = sinon.mock(findClient); @@ -168,7 +166,7 @@ describe("FindNextOperator", () => { const mockFindRepository = sinon.mock(findRepository); mockFindRepository .expects("setLocalState") - .withArgs(currentTabId, { keyword, frameIds, framePos: 0 }); + .withArgs(currentTabId, { keyword, frameId: 0 }); await sut.run(); |