aboutsummaryrefslogtreecommitdiff
path: root/test/content/operators/impls/YankURLOperator.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/content/operators/impls/YankURLOperator.test.ts')
-rw-r--r--test/content/operators/impls/YankURLOperator.test.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/content/operators/impls/YankURLOperator.test.ts b/test/content/operators/impls/YankURLOperator.test.ts
new file mode 100644
index 0000000..46e3d06
--- /dev/null
+++ b/test/content/operators/impls/YankURLOperator.test.ts
@@ -0,0 +1,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;
+ });
+ });
+});