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