aboutsummaryrefslogtreecommitdiff
path: root/test/background/operators/impls/PinTabOperator.test.ts
blob: 69082f2ae186fa4a8008ffa5984c66e0b4f46477 (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 PinTabOperator from "../../../../src/background/operators/impls/PinTabOperator";
import MockTabPresenter from "../../mock/MockTabPresenter";

describe("PinTabOperator", () => {
  describe("#run", () => {
    it("make 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 PinTabOperator(tabPresenter);

      await sut.run();

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