aboutsummaryrefslogtreecommitdiff
path: root/test/content/operators/impls/ClipboardOperatorFactoryChain.test.ts
blob: 9ddc22926cac12c75189f8807ec87620c07b3c19 (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
25
26
27
28
29
30
31
import * as operations from "../../../../src/shared/operations";
import { expect } from "chai";
import ClipboardOperatorFactoryChain from "../../../../src/content/operators/impls/ClipboardOperatorFactoryChain";
import YankURLOperator from "../../../../src/content/operators/impls/YankURLOperator";
import PasteOperator from "../../../../src/content/operators/impls/PasteOperator";
import MockClipboardRepository from "../../mock/MockClipboardRepository";
import MockOperationClient from "../../mock/MockOperationClient";
import MockSettingRepository from "../../mock/MockSettingRepository";
import MockConsoleClient from "../../mock/MockConsoleClient";
import MockURLRepository from "../../mock/MockURLRepository";

describe("ClipboardOperatorFactoryChain", () => {
  describe("#create", () => {
    it("returns an operator", () => {
      const sut = new ClipboardOperatorFactoryChain(
        new MockClipboardRepository(),
        new MockConsoleClient(),
        new MockOperationClient(),
        new MockSettingRepository(),
        new MockURLRepository()
      );
      expect(sut.create({ type: operations.URLS_YANK }, 0)).to.be.instanceOf(
        YankURLOperator
      );
      expect(
        sut.create({ type: operations.URLS_PASTE, newTab: false }, 0)
      ).to.be.instanceOf(PasteOperator);
      expect(sut.create({ type: operations.SCROLL_TOP }, 0)).to.be.null;
    });
  });
});