aboutsummaryrefslogtreecommitdiff
path: root/test/content/operators/impls/YankURLOperator.test.ts
blob: 3db28bfe4b48d410e7069ab03a831693bbf837eb (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
import MockClipboardRepository from "../../mock/MockClipboardRepository";
import YankURLOperator from "../../../../src/content/operators/impls/YankURLOperator";
import MockURLRepository from "../../mock/MockURLRepository";
import MockConsoleClient from "../../mock/MockConsoleClient";

describe("YankOperation", () => {
  describe("#run", () => {
    it("copy current URL", async () => {
      const clipboardRepository = new MockClipboardRepository();
      const consoleClient = new MockConsoleClient();
      const urlRepository = new MockURLRepository("https://example.com/");
      const sut = new YankURLOperator(
        clipboardRepository,
        consoleClient,
        urlRepository
      );

      await sut.run();

      expect(clipboardRepository.read()).toEqual("https://example.com/");
      expect(consoleClient.text).toEqual("Yanked https://example.com/");
      expect(consoleClient.isError).toBeFalsy;
    });
  });
});