diff options
Diffstat (limited to 'test/background/operators/impls/TogglePinnedTabOperator.test.ts')
-rw-r--r-- | test/background/operators/impls/TogglePinnedTabOperator.test.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/background/operators/impls/TogglePinnedTabOperator.test.ts b/test/background/operators/impls/TogglePinnedTabOperator.test.ts new file mode 100644 index 0000000..f155f83 --- /dev/null +++ b/test/background/operators/impls/TogglePinnedTabOperator.test.ts @@ -0,0 +1,32 @@ +import { expect } from "chai"; +import TogglePinnedTabOperator from "../../../../src/background/operators/impls/TogglePinnedTabOperator"; +import MockTabPresenter from "../../mock/MockTabPresenter"; + +describe("TogglePinnedTabOperator", () => { + describe("#run", () => { + it("toggle pinned to the current tab", async () => { + const tabPresenter = new MockTabPresenter(); + await tabPresenter.create("https://example.com/", { + active: true, + pinned: false, + }); + await tabPresenter.create("https://example.com/", { + active: false, + pinned: false, + }); + const sut = new TogglePinnedTabOperator(tabPresenter); + + await sut.run(); + expect((await tabPresenter.getAll()).map((t) => t.pinned)).to.deep.equal([ + true, + false, + ]); + + await sut.run(); + expect((await tabPresenter.getAll()).map((t) => t.pinned)).to.deep.equal([ + false, + false, + ]); + }); + }); +}); |