aboutsummaryrefslogtreecommitdiff
path: root/test/content/operators/impls/PasteOperator.test.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-09-30 00:16:32 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2021-09-30 00:24:35 +0900
commitacfe1b78009b0c3183cd69eebdabb458e2079b73 (patch)
tree20b6c71228976173f4086d34aec552feadb461fc /test/content/operators/impls/PasteOperator.test.ts
parentc843809ba29bd70c28b9a19e4cb3f1002edee781 (diff)
Move mock library to jest
Diffstat (limited to 'test/content/operators/impls/PasteOperator.test.ts')
-rw-r--r--test/content/operators/impls/PasteOperator.test.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/content/operators/impls/PasteOperator.test.ts b/test/content/operators/impls/PasteOperator.test.ts
index 8a3a374..fa42576 100644
--- a/test/content/operators/impls/PasteOperator.test.ts
+++ b/test/content/operators/impls/PasteOperator.test.ts
@@ -1,4 +1,3 @@
-import sinon from "sinon";
import PasteOperator from "../../../../src/content/operators/impls/PasteOperator";
import MockClipboardRepository from "../../mock/MockClipboardRepository";
import MockSettingRepository from "../../mock/MockSettingRepository";
@@ -10,10 +9,9 @@ describe("PasteOperator", () => {
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 internalOpenUrlSpy = jest
+ .spyOn(operationClient, "internalOpenUrl")
+ .mockReturnValue(Promise.resolve());
const sut = new PasteOperator(
clipboardRepository,
settingRepository,
@@ -23,7 +21,10 @@ describe("PasteOperator", () => {
await sut.run();
- mockOperationClient.verify();
+ expect(internalOpenUrlSpy).toBeCalledWith(
+ "https://google.com/search?q=apple",
+ false
+ );
});
it("open a url", async () => {
@@ -32,10 +33,9 @@ describe("PasteOperator", () => {
);
const settingRepository = new MockSettingRepository();
const operationClient = new MockOperationClient();
- const mockOperationClient = sinon
- .mock(operationClient)
- .expects("internalOpenUrl")
- .withArgs("https://example.com/");
+ const internalOpenUrlSpy = jest
+ .spyOn(operationClient, "internalOpenUrl")
+ .mockReturnValue(Promise.resolve());
const sut = new PasteOperator(
clipboardRepository,
settingRepository,
@@ -45,7 +45,7 @@ describe("PasteOperator", () => {
await sut.run();
- mockOperationClient.verify();
+ expect(internalOpenUrlSpy).toBeCalledWith("https://example.com/", false);
});
});
});