blob: 8a3a3741f87f44101225b34df609b1ab72b9ecd9 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import sinon from "sinon";
import PasteOperator from "../../../../src/content/operators/impls/PasteOperator";
import MockClipboardRepository from "../../mock/MockClipboardRepository";
import MockSettingRepository from "../../mock/MockSettingRepository";
import MockOperationClient from "../../mock/MockOperationClient";
describe("PasteOperator", () => {
describe("#run", () => {
it("open a search url", async () => {
const clipboardRepository = new MockClipboardRepository("apple");
const settingRepository = new MockSettingRepository();
const operationClient = new MockOperationClient();
const mockOperationClient = sinon
.mock(operationClient)
.expects("internalOpenUrl")
.withArgs("https://google.com/search?q=apple");
const sut = new PasteOperator(
clipboardRepository,
settingRepository,
operationClient,
false
);
await sut.run();
mockOperationClient.verify();
});
it("open a url", async () => {
const clipboardRepository = new MockClipboardRepository(
"https://example.com/"
);
const settingRepository = new MockSettingRepository();
const operationClient = new MockOperationClient();
const mockOperationClient = sinon
.mock(operationClient)
.expects("internalOpenUrl")
.withArgs("https://example.com/");
const sut = new PasteOperator(
clipboardRepository,
settingRepository,
operationClient,
false
);
await sut.run();
mockOperationClient.verify();
});
});
});
|