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

describe("CancelOperator", () => {
  describe("#run", () => {
    it("hides console", async () => {
      const tabPresenter = new MockTabPresenter();
      const currenTab = await tabPresenter.create("https://example.com/");

      const consoleClient = new MockConsoleClient();
      const spy = jest
        .spyOn(consoleClient, "hide")
        .mockResolvedValueOnce(undefined);
      const sut = new CancelOperator(tabPresenter, consoleClient);

      await sut.run();

      expect(spy).toBeCalledWith(currenTab?.id);
    });
  });
});