diff options
Diffstat (limited to 'test/content/operators/impls')
23 files changed, 76 insertions, 100 deletions
diff --git a/test/content/operators/impls/AddonOperatorFactoryChain.test.ts b/test/content/operators/impls/AddonOperatorFactoryChain.test.ts index dde5a35..263104e 100644 --- a/test/content/operators/impls/AddonOperatorFactoryChain.test.ts +++ b/test/content/operators/impls/AddonOperatorFactoryChain.test.ts @@ -3,7 +3,6 @@ import EnableAddonOperator from "../../../../src/content/operators/impls/EnableA import DisableAddonOperator from "../../../../src/content/operators/impls/DisableAddonOperator"; import ToggleAddonOperator from "../../../../src/content/operators/impls/ToggleAddonOperator"; import * as operations from "../../../../src/shared/operations"; -import { expect } from "chai"; import MockAddonIndicatorClient from "../../mock/MockAddonIndicatorClient"; import MockAddonEnabledRepository from "../../mock/MockAddonEnabledRepository"; import MockConsoleFramePresenter from "./MockConsoleFramePresenter"; @@ -16,16 +15,16 @@ describe("AddonOperatorFactoryChain", () => { new MockAddonEnabledRepository(), new MockConsoleFramePresenter(false) ); - expect(sut.create({ type: operations.ADDON_ENABLE }, 0)).to.be.instanceOf( + expect(sut.create({ type: operations.ADDON_ENABLE }, 0)).toBeInstanceOf( EnableAddonOperator ); - expect( - sut.create({ type: operations.ADDON_DISABLE }, 0) - ).to.be.instanceOf(DisableAddonOperator); + expect(sut.create({ type: operations.ADDON_DISABLE }, 0)).toBeInstanceOf( + DisableAddonOperator + ); expect( sut.create({ type: operations.ADDON_TOGGLE_ENABLED }, 0) - ).to.be.instanceOf(ToggleAddonOperator); - expect(sut.create({ type: operations.SCROLL_TOP }, 0)).to.be.null; + ).toBeInstanceOf(ToggleAddonOperator); + expect(sut.create({ type: operations.SCROLL_TOP }, 0)).toBeNull; }); }); }); diff --git a/test/content/operators/impls/BackgroundOperationOperator.test.ts b/test/content/operators/impls/BackgroundOperationOperator.test.ts index b8b1fbd..77efeb2 100644 --- a/test/content/operators/impls/BackgroundOperationOperator.test.ts +++ b/test/content/operators/impls/BackgroundOperationOperator.test.ts @@ -1,7 +1,6 @@ import * as operations from "../../../../src/shared/operations"; import BackgroundOperationOperator from "../../../../src/content/operators/impls/BackgroundOperationOperator"; import OperationClient from "../../../../src/content/client/OperationClient"; -import { expect } from "chai"; class MockOperationClient implements OperationClient { public readonly executedOps: { @@ -30,7 +29,7 @@ describe("BackgroundOperationOperator", () => { await sut.run(); - expect(client.executedOps).to.deep.equal([ + expect(client.executedOps).toEqual([ { op: { type: operations.TAB_CLOSE }, repeat: 2 }, ]); }); diff --git a/test/content/operators/impls/ClipboardOperatorFactoryChain.test.ts b/test/content/operators/impls/ClipboardOperatorFactoryChain.test.ts index 9ddc229..d4c61c4 100644 --- a/test/content/operators/impls/ClipboardOperatorFactoryChain.test.ts +++ b/test/content/operators/impls/ClipboardOperatorFactoryChain.test.ts @@ -1,5 +1,4 @@ import * as operations from "../../../../src/shared/operations"; -import { expect } from "chai"; import ClipboardOperatorFactoryChain from "../../../../src/content/operators/impls/ClipboardOperatorFactoryChain"; import YankURLOperator from "../../../../src/content/operators/impls/YankURLOperator"; import PasteOperator from "../../../../src/content/operators/impls/PasteOperator"; @@ -19,13 +18,13 @@ describe("ClipboardOperatorFactoryChain", () => { new MockSettingRepository(), new MockURLRepository() ); - expect(sut.create({ type: operations.URLS_YANK }, 0)).to.be.instanceOf( + expect(sut.create({ type: operations.URLS_YANK }, 0)).toBeInstanceOf( YankURLOperator ); expect( sut.create({ type: operations.URLS_PASTE, newTab: false }, 0) - ).to.be.instanceOf(PasteOperator); - expect(sut.create({ type: operations.SCROLL_TOP }, 0)).to.be.null; + ).toBeInstanceOf(PasteOperator); + expect(sut.create({ type: operations.SCROLL_TOP }, 0)).toBeNull; }); }); }); diff --git a/test/content/operators/impls/DisableAddonOperator.test.ts b/test/content/operators/impls/DisableAddonOperator.test.ts index e05d1f1..bb137ac 100644 --- a/test/content/operators/impls/DisableAddonOperator.test.ts +++ b/test/content/operators/impls/DisableAddonOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import DisableAddonOperator from "../../../../src/content/operators/impls/DisableAddonOperator"; import MockAddonIndicatorClient from "../../mock/MockAddonIndicatorClient"; import MockAddonEnabledRepository from "../../mock/MockAddonEnabledRepository"; @@ -14,9 +13,9 @@ describe("DisableAddonOperator", () => { await sut.run(); - expect(client.enabled).to.be.false; - expect(repository.enabled).to.be.false; - expect(presenter.attached).to.be.false; + expect(client.enabled).toBeFalsy; + expect(repository.enabled).toBeFalsy; + expect(presenter.attached).toBeFalsy; }); }); }); diff --git a/test/content/operators/impls/EnableAddonOperator.test.ts b/test/content/operators/impls/EnableAddonOperator.test.ts index 6025608..cd838af 100644 --- a/test/content/operators/impls/EnableAddonOperator.test.ts +++ b/test/content/operators/impls/EnableAddonOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import EnableAddonOperator from "../../../../src/content/operators/impls/EnableAddonOperator"; import MockAddonIndicatorClient from "../../mock/MockAddonIndicatorClient"; import MockAddonEnabledRepository from "../../mock/MockAddonEnabledRepository"; @@ -14,9 +13,9 @@ describe("EnableAddonOperator", () => { await sut.run(); - expect(client.enabled).to.be.true; - expect(repository.enabled).to.be.true; - expect(presenter.attached).to.be.true; + expect(client.enabled).toBeTruthy; + expect(repository.enabled).toBeTruthy; + expect(presenter.attached).toBeTruthy; }); }); }); diff --git a/test/content/operators/impls/EnableJumpMarkOperator.test.ts b/test/content/operators/impls/EnableJumpMarkOperator.test.ts index 66b4ecd..f81d6dc 100644 --- a/test/content/operators/impls/EnableJumpMarkOperator.test.ts +++ b/test/content/operators/impls/EnableJumpMarkOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import EnableJumpMarkOperator from "../../../../src/content/operators/impls/EnableJumpMarkOperator"; import MockMarkKeyRepository from "../../mock/MockMarkKeyRepository"; @@ -13,7 +12,7 @@ describe("EnableJumpMarkOperator", () => { await sut.run(); - expect(repository.jumpMode).to.be.true; + expect(repository.jumpMode).toBeTruthy; }); }); }); diff --git a/test/content/operators/impls/EnableSetMarkOperator.test.ts b/test/content/operators/impls/EnableSetMarkOperator.test.ts index b28874d..33ce2ba 100644 --- a/test/content/operators/impls/EnableSetMarkOperator.test.ts +++ b/test/content/operators/impls/EnableSetMarkOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import EnableSetMarkOperator from "../../../../src/content/operators/impls/EnableSetMarkOperator"; import MockMarkKeyRepository from "../../mock/MockMarkKeyRepository"; @@ -13,7 +12,7 @@ describe("EnableSetMarkOperator", () => { await sut.run(); - expect(repository.setMode).to.be.true; + expect(repository.setMode).toBeTruthy; }); }); }); diff --git a/test/content/operators/impls/FocusOperator.test.ts b/test/content/operators/impls/FocusOperator.test.ts index a0eb53b..2d72620 100644 --- a/test/content/operators/impls/FocusOperator.test.ts +++ b/test/content/operators/impls/FocusOperator.test.ts @@ -1,4 +1,3 @@ -import sinon from "sinon"; import FocusOperator from "../../../../src/content/operators/impls/FocusOperator"; import MockFocusPresenter from "../../mock/MockFocusPresenter"; @@ -6,12 +5,14 @@ describe("FocusOperator", () => { describe("#run", () => { it("focus a first input", async () => { const presenter = new MockFocusPresenter(); - const mock = sinon.mock(presenter).expects("focusFirstElement"); + const focusFirstElementSpy = jest + .spyOn(presenter, "focusFirstElement") + .mockReturnValue(true); const sut = new FocusOperator(presenter); await sut.run(); - mock.verify(); + expect(focusFirstElementSpy).toBeCalled(); }); }); }); diff --git a/test/content/operators/impls/FocusOperatorFactoryChain.test.ts b/test/content/operators/impls/FocusOperatorFactoryChain.test.ts index 91f734b..84a4a52 100644 --- a/test/content/operators/impls/FocusOperatorFactoryChain.test.ts +++ b/test/content/operators/impls/FocusOperatorFactoryChain.test.ts @@ -1,5 +1,4 @@ import * as operations from "../../../../src/shared/operations"; -import { expect } from "chai"; import FocusOperatorFactoryChain from "../../../../src/content/operators/impls/FocusOperatorFactoryChain"; import FocusOperator from "../../../../src/content/operators/impls/FocusOperator"; import MockFocusPresenter from "../../mock/MockFocusPresenter"; @@ -8,10 +7,10 @@ describe("FocusOperatorFactoryChain", () => { describe("#create", () => { it("returns an operator", () => { const sut = new FocusOperatorFactoryChain(new MockFocusPresenter()); - expect(sut.create({ type: operations.FOCUS_INPUT }, 0)).to.be.instanceOf( + expect(sut.create({ type: operations.FOCUS_INPUT }, 0)).toBeInstanceOf( FocusOperator ); - expect(sut.create({ type: operations.SCROLL_TOP }, 0)).to.be.null; + expect(sut.create({ type: operations.SCROLL_TOP }, 0)).toBeNull; }); }); }); diff --git a/test/content/operators/impls/FollowOperatorFactoryChain.test.ts b/test/content/operators/impls/FollowOperatorFactoryChain.test.ts index 526a93c..84a4a52 100644 --- a/test/content/operators/impls/FollowOperatorFactoryChain.test.ts +++ b/test/content/operators/impls/FollowOperatorFactoryChain.test.ts @@ -1,5 +1,4 @@ import * as operations from "../../../../src/shared/operations"; -import { expect } from "chai"; import FocusOperatorFactoryChain from "../../../../src/content/operators/impls/FocusOperatorFactoryChain"; import FocusOperator from "../../../../src/content/operators/impls/FocusOperator"; import MockFocusPresenter from "../../mock/MockFocusPresenter"; @@ -8,13 +7,10 @@ describe("FocusOperatorFactoryChain", () => { describe("#create", () => { it("returns an operator", () => { const sut = new FocusOperatorFactoryChain(new MockFocusPresenter()); - expect( - sut.create( - { type: operations.FOCUS_INPUT, newTab: false, background: false }, - 0 - ) - ).to.be.instanceOf(FocusOperator); - expect(sut.create({ type: operations.SCROLL_TOP }, 0)).to.be.null; + expect(sut.create({ type: operations.FOCUS_INPUT }, 0)).toBeInstanceOf( + FocusOperator + ); + expect(sut.create({ type: operations.SCROLL_TOP }, 0)).toBeNull; }); }); }); diff --git a/test/content/operators/impls/HorizontalScrollOperator.test.ts b/test/content/operators/impls/HorizontalScrollOperator.test.ts index f77a34e..abe6856 100644 --- a/test/content/operators/impls/HorizontalScrollOperator.test.ts +++ b/test/content/operators/impls/HorizontalScrollOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import HorizontalScrollOperator from "../../../../src/content/operators/impls/HorizontalScrollOperator"; import MockScrollPresenter from "../../mock/MockScrollPresenter"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -12,7 +11,7 @@ describe("HorizontalScrollOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 1, y: 0 }); + expect(presenter.getScroll()).toEqual({ x: 1, y: 0 }); }); it("scroll horizontally with repeats", async () => { @@ -22,7 +21,7 @@ describe("HorizontalScrollOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 5, y: 0 }); + expect(presenter.getScroll()).toEqual({ x: 5, y: 0 }); }); }); }); diff --git a/test/content/operators/impls/MarkOperatorFactoryChain.test.ts b/test/content/operators/impls/MarkOperatorFactoryChain.test.ts index 1f094dd..99cb756 100644 --- a/test/content/operators/impls/MarkOperatorFactoryChain.test.ts +++ b/test/content/operators/impls/MarkOperatorFactoryChain.test.ts @@ -1,5 +1,4 @@ import * as operations from "../../../../src/shared/operations"; -import { expect } from "chai"; import MarkOperatorFactoryChain from "../../../../src/content/operators/impls/MarkOperatorFactoryChain"; import MockMarkKeyRepository from "../../mock/MockMarkKeyRepository"; import EnableSetMarkOperator from "../../../../src/content/operators/impls/EnableSetMarkOperator"; @@ -11,11 +10,11 @@ describe("MarkOperatorFactoryChain", () => { const sut = new MarkOperatorFactoryChain(new MockMarkKeyRepository()); expect( sut.create({ type: operations.MARK_SET_PREFIX }, 0) - ).to.be.instanceOf(EnableSetMarkOperator); + ).toBeInstanceOf(EnableSetMarkOperator); expect( sut.create({ type: operations.MARK_JUMP_PREFIX }, 0) - ).to.be.instanceOf(EnableJumpMarkOperator); - expect(sut.create({ type: operations.SCROLL_TOP }, 0)).to.be.null; + ).toBeInstanceOf(EnableJumpMarkOperator); + expect(sut.create({ type: operations.SCROLL_TOP }, 0)).toBeNull; }); }); }); diff --git a/test/content/operators/impls/PageScrollOperator.test.ts b/test/content/operators/impls/PageScrollOperator.test.ts index 80c9185..77d3a0f 100644 --- a/test/content/operators/impls/PageScrollOperator.test.ts +++ b/test/content/operators/impls/PageScrollOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import PageScrollOperator from "../../../../src/content/operators/impls/PageScrollOperator"; import MockScrollPresenter from "../../mock/MockScrollPresenter"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -12,7 +11,7 @@ describe("PageScrollOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 1, y: 0 }); + expect(presenter.getScroll()).toEqual({ x: 1, y: 0 }); }); it("scroll by a page with repeats", async () => { @@ -22,7 +21,7 @@ describe("PageScrollOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 5, y: 0 }); + expect(presenter.getScroll()).toEqual({ x: 5, y: 0 }); }); }); }); diff --git a/test/content/operators/impls/PasteOperator.test.ts b/test/content/operators/impls/PasteOperator.test.ts index 8a3a374..fa42576 100644 --- a/test/content/operators/impls/PasteOperator.test.ts +++ b/test/content/operators/impls/PasteOperator.test.ts @@ -1,4 +1,3 @@ -import sinon from "sinon"; import PasteOperator from "../../../../src/content/operators/impls/PasteOperator"; import MockClipboardRepository from "../../mock/MockClipboardRepository"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -10,10 +9,9 @@ describe("PasteOperator", () => { const clipboardRepository = new MockClipboardRepository("apple"); const settingRepository = new MockSettingRepository(); const operationClient = new MockOperationClient(); - const mockOperationClient = sinon - .mock(operationClient) - .expects("internalOpenUrl") - .withArgs("https://google.com/search?q=apple"); + const internalOpenUrlSpy = jest + .spyOn(operationClient, "internalOpenUrl") + .mockReturnValue(Promise.resolve()); const sut = new PasteOperator( clipboardRepository, settingRepository, @@ -23,7 +21,10 @@ describe("PasteOperator", () => { await sut.run(); - mockOperationClient.verify(); + expect(internalOpenUrlSpy).toBeCalledWith( + "https://google.com/search?q=apple", + false + ); }); it("open a url", async () => { @@ -32,10 +33,9 @@ describe("PasteOperator", () => { ); const settingRepository = new MockSettingRepository(); const operationClient = new MockOperationClient(); - const mockOperationClient = sinon - .mock(operationClient) - .expects("internalOpenUrl") - .withArgs("https://example.com/"); + const internalOpenUrlSpy = jest + .spyOn(operationClient, "internalOpenUrl") + .mockReturnValue(Promise.resolve()); const sut = new PasteOperator( clipboardRepository, settingRepository, @@ -45,7 +45,7 @@ describe("PasteOperator", () => { await sut.run(); - mockOperationClient.verify(); + expect(internalOpenUrlSpy).toBeCalledWith("https://example.com/", false); }); }); }); diff --git a/test/content/operators/impls/ScrollOperatorFactoryChain.test.ts b/test/content/operators/impls/ScrollOperatorFactoryChain.test.ts index 08034cb..3ba204a 100644 --- a/test/content/operators/impls/ScrollOperatorFactoryChain.test.ts +++ b/test/content/operators/impls/ScrollOperatorFactoryChain.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import ScrollOperatorFactoryChain from "../../../../src/content/operators/impls/ScrollOperatorFactoryChain"; import MockScrollPresenter from "../../mock/MockScrollPresenter"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -20,27 +19,27 @@ describe("ScrollOperatorFactoryChain", () => { ); expect( sut.create({ type: operations.SCROLL_HORIZONALLY, count: 10 }, 0) - ).to.be.instanceOf(HorizontalScrollOperator); + ).toBeInstanceOf(HorizontalScrollOperator); expect( sut.create({ type: operations.SCROLL_VERTICALLY, count: 10 }, 0) - ).to.be.instanceOf(VerticalScrollOperator); + ).toBeInstanceOf(VerticalScrollOperator); expect( sut.create({ type: operations.SCROLL_PAGES, count: 10 }, 0) - ).to.be.instanceOf(PageScrollOperator); - expect(sut.create({ type: operations.SCROLL_TOP }, 0)).to.be.instanceOf( + ).toBeInstanceOf(PageScrollOperator); + expect(sut.create({ type: operations.SCROLL_TOP }, 0)).toBeInstanceOf( ScrollToTopOperator ); - expect( - sut.create({ type: operations.SCROLL_BOTTOM }, 0) - ).to.be.instanceOf(ScrollToBottomOperator); - expect(sut.create({ type: operations.SCROLL_HOME }, 0)).to.be.instanceOf( + expect(sut.create({ type: operations.SCROLL_BOTTOM }, 0)).toBeInstanceOf( + ScrollToBottomOperator + ); + expect(sut.create({ type: operations.SCROLL_HOME }, 0)).toBeInstanceOf( ScrollToHomeOperator ); - expect(sut.create({ type: operations.SCROLL_END }, 0)).to.be.instanceOf( + expect(sut.create({ type: operations.SCROLL_END }, 0)).toBeInstanceOf( ScrollToEndOperator ); - expect(sut.create({ type: operations.PAGE_HOME, newTab: false }, 0)).to.be - .null; + expect(sut.create({ type: operations.PAGE_HOME, newTab: false }, 0)) + .toBeNull; }); }); }); diff --git a/test/content/operators/impls/ScrollToBottomOperator.test.ts b/test/content/operators/impls/ScrollToBottomOperator.test.ts index 500c8f2..f369227 100644 --- a/test/content/operators/impls/ScrollToBottomOperator.test.ts +++ b/test/content/operators/impls/ScrollToBottomOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import ScrollToBottomOperator from "../../../../src/content/operators/impls/ScrollToBottomOperator"; import MockScrollPresenter from "../../mock/MockScrollPresenter"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -12,7 +11,7 @@ describe("ScrollToBottomOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 0, y: Infinity }); + expect(presenter.getScroll()).toEqual({ x: 0, y: Infinity }); }); }); }); diff --git a/test/content/operators/impls/ScrollToEndOperator.test.ts b/test/content/operators/impls/ScrollToEndOperator.test.ts index 0c98c8d..304d914 100644 --- a/test/content/operators/impls/ScrollToEndOperator.test.ts +++ b/test/content/operators/impls/ScrollToEndOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import ScrollToEndOperator from "../../../../src/content/operators/impls/ScrollToEndOperator"; import MockScrollPresenter from "../../mock/MockScrollPresenter"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -12,7 +11,7 @@ describe("ScrollToEndOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: Infinity, y: 0 }); + expect(presenter.getScroll()).toEqual({ x: Infinity, y: 0 }); }); }); }); diff --git a/test/content/operators/impls/ScrollToHomeOperator.test.ts b/test/content/operators/impls/ScrollToHomeOperator.test.ts index f8614d2..e09c16a 100644 --- a/test/content/operators/impls/ScrollToHomeOperator.test.ts +++ b/test/content/operators/impls/ScrollToHomeOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import ScrollToHomeOperator from "../../../../src/content/operators/impls/ScrollToHomeOperator"; import MockScrollPresenter from "../../mock/MockScrollPresenter"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -12,7 +11,7 @@ describe("ScrollToHomeOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 0, y: 10 }); + expect(presenter.getScroll()).toEqual({ x: 0, y: 10 }); }); }); }); diff --git a/test/content/operators/impls/ScrollToTopOperator.test.ts b/test/content/operators/impls/ScrollToTopOperator.test.ts index 25a84ba..7337bea 100644 --- a/test/content/operators/impls/ScrollToTopOperator.test.ts +++ b/test/content/operators/impls/ScrollToTopOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import ScrollToTopOperator from "../../../../src/content/operators/impls/ScrollToTopOperator"; import MockScrollPresenter from "../../mock/MockScrollPresenter"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -12,7 +11,7 @@ describe("ScrollToTopOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 10, y: 0 }); + expect(presenter.getScroll()).toEqual({ x: 10, y: 0 }); }); }); }); diff --git a/test/content/operators/impls/StartFollowOperator.test.ts b/test/content/operators/impls/StartFollowOperator.test.ts index 8f9bd2d..4216cd0 100644 --- a/test/content/operators/impls/StartFollowOperator.test.ts +++ b/test/content/operators/impls/StartFollowOperator.test.ts @@ -1,4 +1,3 @@ -import sinon from "sinon"; import StartFollowOperator from "../../../../src/content/operators/impls/StartFollowOperator"; import MockFollowMasterClient from "../../mock/MockFollowMasterClient"; @@ -6,15 +5,14 @@ describe("StartFollowOperator", () => { describe("#run", () => { it("starts following links", async () => { const client = new MockFollowMasterClient(); - const mock = sinon - .mock(client) - .expects("startFollow") - .withArgs(true, false); + const startFollowSpy = jest + .spyOn(client, "startFollow") + .mockReturnValue(); const sut = new StartFollowOperator(client, true, false); await sut.run(); - mock.verify(); + expect(startFollowSpy).toBeCalledWith(true, false); }); }); }); diff --git a/test/content/operators/impls/ToggleAddonOperator.test.ts b/test/content/operators/impls/ToggleAddonOperator.test.ts index 1f291b5..cc77429 100644 --- a/test/content/operators/impls/ToggleAddonOperator.test.ts +++ b/test/content/operators/impls/ToggleAddonOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import ToggleAddonOperator from "../../../../src/content/operators/impls/ToggleAddonOperator"; import MockAddonIndicatorClient from "../../mock/MockAddonIndicatorClient"; import MockAddonEnabledRepository from "../../mock/MockAddonEnabledRepository"; @@ -14,15 +13,15 @@ describe("ToggleAddonOperator", () => { await sut.run(); - expect(client.enabled).to.be.false; - expect(repository.enabled).to.be.false; - expect(presenter.attached).to.be.false; + expect(client.enabled).toBeFalsy; + expect(repository.enabled).toBeFalsy; + expect(presenter.attached).toBeFalsy; await sut.run(); - expect(client.enabled).to.be.true; - expect(repository.enabled).to.be.true; - expect(presenter.attached).to.be.true; + expect(client.enabled).toBeTruthy; + expect(repository.enabled).toBeTruthy; + expect(presenter.attached).toBeTruthy; }); }); }); diff --git a/test/content/operators/impls/VerticalScrollOperator.test.ts b/test/content/operators/impls/VerticalScrollOperator.test.ts index 05b15d2..1b87060 100644 --- a/test/content/operators/impls/VerticalScrollOperator.test.ts +++ b/test/content/operators/impls/VerticalScrollOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import VerticalScrollOperator from "../../../../src/content/operators/impls/VerticalScrollOperator"; import MockScrollPresenter from "../../mock/MockScrollPresenter"; import MockSettingRepository from "../../mock/MockSettingRepository"; @@ -12,7 +11,7 @@ describe("VerticalScrollOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 0, y: 1 }); + expect(presenter.getScroll()).toEqual({ x: 0, y: 1 }); }); it("scroll vertically with repeats", async () => { @@ -22,7 +21,7 @@ describe("VerticalScrollOperator", () => { await sut.run(); - expect(presenter.getScroll()).to.deep.equal({ x: 0, y: 5 }); + expect(presenter.getScroll()).toEqual({ x: 0, y: 5 }); }); }); }); diff --git a/test/content/operators/impls/YankURLOperator.test.ts b/test/content/operators/impls/YankURLOperator.test.ts index 46e3d06..3db28bf 100644 --- a/test/content/operators/impls/YankURLOperator.test.ts +++ b/test/content/operators/impls/YankURLOperator.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import MockClipboardRepository from "../../mock/MockClipboardRepository"; import YankURLOperator from "../../../../src/content/operators/impls/YankURLOperator"; import MockURLRepository from "../../mock/MockURLRepository"; @@ -18,9 +17,9 @@ describe("YankOperation", () => { await sut.run(); - expect(clipboardRepository.read()).to.equal("https://example.com/"); - expect(consoleClient.text).to.equal("Yanked https://example.com/"); - expect(consoleClient.isError).to.be.false; + expect(clipboardRepository.read()).toEqual("https://example.com/"); + expect(consoleClient.text).toEqual("Yanked https://example.com/"); + expect(consoleClient.isError).toBeFalsy; }); }); }); |