aboutsummaryrefslogtreecommitdiff
path: root/test/background/operators/impls/CancelOperator.test.ts
blob: 915becf4776c709f04b993f0be2a2e01a701a2b6 (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 sinon from "sinon";
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 mock = sinon
        .mock(consoleClient)
        .expects("hide")
        .withArgs(currenTab?.id);
      const sut = new CancelOperator(tabPresenter, consoleClient);

      await sut.run();

      mock.verify();
    });
  });
});