From c523d75472a16dc58e2e4c4ee51eb15efe6c11f9 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 29 Nov 2020 13:55:26 +0900 Subject: Add operators' test --- .../operators/impls/ToggleAddonOperator.test.ts | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/content/operators/impls/ToggleAddonOperator.test.ts (limited to 'test/content/operators/impls/ToggleAddonOperator.test.ts') diff --git a/test/content/operators/impls/ToggleAddonOperator.test.ts b/test/content/operators/impls/ToggleAddonOperator.test.ts new file mode 100644 index 0000000..6026eb1 --- /dev/null +++ b/test/content/operators/impls/ToggleAddonOperator.test.ts @@ -0,0 +1,24 @@ +import { expect } from "chai"; +import ToggleAddonOperator from "../../../../src/content/operators/impls/ToggleAddonOperator"; +import MockAddonIndicatorClient from "../../mock/MockAddonIndicatorClient"; +import MockAddonEnabledRepository from "../../mock/MockAddonEnabledRepository"; + +describe("ToggleAddonOperator", () => { + describe("#run", () => { + it("toggles addon-enabled state", async () => { + const client = new MockAddonIndicatorClient(true); + const repository = new MockAddonEnabledRepository(true); + const sut = new ToggleAddonOperator(client, repository); + + await sut.run(); + + expect(client.enabled).to.be.false; + expect(repository.enabled).to.be.false; + + await sut.run(); + + expect(client.enabled).to.be.true; + expect(repository.enabled).to.be.true; + }); + }); +}); -- cgit v1.2.3