diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-30 00:16:32 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-30 00:24:35 +0900 |
commit | acfe1b78009b0c3183cd69eebdabb458e2079b73 (patch) | |
tree | 20b6c71228976173f4086d34aec552feadb461fc /test/background/operators/impls/SelectPreviousSelectedTabOperator.test.ts | |
parent | c843809ba29bd70c28b9a19e4cb3f1002edee781 (diff) |
Move mock library to jest
Diffstat (limited to 'test/background/operators/impls/SelectPreviousSelectedTabOperator.test.ts')
-rw-r--r-- | test/background/operators/impls/SelectPreviousSelectedTabOperator.test.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/background/operators/impls/SelectPreviousSelectedTabOperator.test.ts b/test/background/operators/impls/SelectPreviousSelectedTabOperator.test.ts index 5d6827d..7872b2f 100644 --- a/test/background/operators/impls/SelectPreviousSelectedTabOperator.test.ts +++ b/test/background/operators/impls/SelectPreviousSelectedTabOperator.test.ts @@ -1,4 +1,3 @@ -import sinon from "sinon"; import MockTabPresenter from "../../mock/MockTabPresenter"; import SelectPreviousSelectedTabOperator from "../../../../src/background/operators/impls/SelectPreviousSelectedTabOperator"; @@ -9,7 +8,7 @@ describe("SelectPreviousSelectedTabOperator", () => { await tabPresenter.create("https://example.com/1", { active: false }); await tabPresenter.create("https://example.com/2", { active: true }); await tabPresenter.create("https://example.com/3", { active: false }); - sinon.stub(tabPresenter, "getLastSelectedId").returns(Promise.resolve(0)); + jest.spyOn(tabPresenter, "getLastSelectedId").mockResolvedValue(0); const sut = new SelectPreviousSelectedTabOperator(tabPresenter); await sut.run(); @@ -23,15 +22,15 @@ describe("SelectPreviousSelectedTabOperator", () => { await tabPresenter.create("https://example.com/1", { active: false }); await tabPresenter.create("https://example.com/2", { active: true }); await tabPresenter.create("https://example.com/3", { active: false }); - sinon - .stub(tabPresenter, "getLastSelectedId") - .returns(Promise.resolve(undefined)); - const mock = sinon.mock(tabPresenter).expects("select").never(); + jest + .spyOn(tabPresenter, "getLastSelectedId") + .mockResolvedValue(undefined); + const selectSpy = jest.spyOn(tabPresenter, "select"); const sut = new SelectPreviousSelectedTabOperator(tabPresenter); await sut.run(); - mock.verify(); + expect(selectSpy).not.toBeCalled(); }); }); }); |