aboutsummaryrefslogtreecommitdiff
path: root/test/background/operators/impls/UnpinTabOperator.test.ts
blob: c30c94f891885e71dbae3eb207695a3e963bf80a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import UnpinTabOperator from "../../../../src/background/operators/impls/UnpinTabOperator";
import MockTabPresenter from "../../mock/MockTabPresenter";

describe("UnpinTabOperator", () => {
  describe("#run", () => {
    it("make unpinned to the current tab", async () => {
      const tabPresenter = new MockTabPresenter();
      await tabPresenter.create("https://example.com/", {
        active: true,
        pinned: true,
      });
      await tabPresenter.create("https://example.com/", {
        active: false,
        pinned: true,
      });
      const sut = new UnpinTabOperator(tabPresenter);

      await sut.run();

      const pins = (await tabPresenter.getAll()).map((t) => t.pinned);
      expect(pins).toEqual([false, true]);
    });
  });
});