aboutsummaryrefslogtreecommitdiff
path: root/test/content/operators/impls/YankURLOperator.test.ts
blob: 46e3d060fe110621152f388522df47bdef28102f (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
import { expect } from "chai";
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()).to.equal("https://example.com/");
      expect(consoleClient.text).to.equal("Yanked https://example.com/");
      expect(consoleClient.isError).to.be.false;
    });
  });
});