Skip to content

Commit

Permalink
fix: fix sinon related build erros
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed Nov 24, 2018
1 parent 081e845 commit 8634e71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/spec/backgroud.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import "mocha";
import * as sinon from "sinon";
import sinon = require("sinon");
import SinonChrome = require("sinon-chrome");
import * as root from "window-or-global";

Expand Down Expand Up @@ -57,10 +57,11 @@ describe("Background script", () => {
},
});
const command = new Command("Scan https://www.wikipedia.org/ as a url on Urlscan");
sinon.stub(command, "scan").withArgs({
const stub: sinon.SinonStub = sinon.stub(command, "scan").withArgs({
urlscanApiKey: "test",
virusTotalApiKey: "test",
}).returns("https://urlscan.io/entry/ac04bc14-4efe-439d-b356-8384843daf75/");
});
stub.returns("https://urlscan.io/entry/ac04bc14-4efe-439d-b356-8384843daf75/");

expect(root.chrome.tabs.create.notCalled).to.be.true;
await scan(command);
Expand Down
12 changes: 6 additions & 6 deletions src/spec/options.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { JSDOM } from "jsdom";
import "mocha";
import * as sinon from "sinon";
import sinon = require("sinon");
import SinonChrome = require("sinon-chrome");
import * as root from "window-or-global";

Expand All @@ -28,7 +28,7 @@ describe("Options script", () => {
const input = root.document.createElement("input") as HTMLInputElement;
input.value = "test";

const stub = sinon.stub(root.document, "getElementById");
const stub: sinon.SinonStub = sinon.stub(root.document, "getElementById");
stub.withArgs("urlscan-api-key").returns(input);
stub.withArgs("virustotal-api-key").returns(input);
});
Expand Down Expand Up @@ -63,7 +63,7 @@ describe("Options script", () => {
element.appendChild(radio1);
element.appendChild(radio2);

const stub = sinon.stub(root.document, "getElementById");
const stub: sinon.SinonStub = sinon.stub(root.document, "getElementById");
stub.withArgs("searcherList").returns(element);
});
afterEach(() => {
Expand All @@ -90,7 +90,7 @@ describe("Options script", () => {
const virusTotalApiKey = root.document.createElement("input") as HTMLInputElement;
virusTotalApiKey.value = "test";

const stub = sinon.stub(root.document, "getElementById");
const stub: sinon.SinonStub = sinon.stub(root.document, "getElementById");
stub.withArgs("urlscan-api-key").returns(urlscanApiKey);
stub.withArgs("virustotal-api-key").returns(virusTotalApiKey);
});
Expand Down Expand Up @@ -119,10 +119,10 @@ describe("Options script", () => {
const dom = new JSDOM();
root.document = dom.window.document;

const searcherList = root.document.createElement("div") as HTMLElement; ;
const searcherList = root.document.createElement("div") as HTMLElement;;
searcherList.id = "searcherList";

const stub = sinon.stub(root.document, "getElementById");
const stub: sinon.SinonStub = sinon.stub(root.document, "getElementById");
stub.withArgs("searcherList").returns(searcherList);
stub.withArgs("checkTemplate").returns({
innerHTML: `
Expand Down

0 comments on commit 8634e71

Please sign in to comment.