Skip to content

Commit ca53360

Browse files
committed
Fix tests
1 parent bbf184b commit ca53360

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/analyze-action-env.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ test("analyze action with RAM & threads from environment variables", async (t) =
4747
const requiredInputStub = sinon.stub(actionsUtil, "getRequiredInput");
4848
requiredInputStub.withArgs("token").returns("fake-token");
4949
requiredInputStub.withArgs("upload-database").returns("false");
50+
requiredInputStub.withArgs("output").returns("out");
5051
const optionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
5152
optionalInputStub.withArgs("cleanup-level").returns("none");
5253
optionalInputStub.withArgs("expect-error").returns("false");

src/analyze-action-input.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ test("analyze action with RAM & threads from action inputs", async (t) => {
4545
const requiredInputStub = sinon.stub(actionsUtil, "getRequiredInput");
4646
requiredInputStub.withArgs("token").returns("fake-token");
4747
requiredInputStub.withArgs("upload-database").returns("false");
48+
requiredInputStub.withArgs("output").returns("out");
4849
const optionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
4950
optionalInputStub.withArgs("cleanup-level").returns("none");
5051
optionalInputStub.withArgs("expect-error").returns("false");

src/upload-lib.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import * as jsonschema from "jsonschema";
99
import * as semver from "semver";
1010

1111
import * as actionsUtil from "./actions-util";
12-
import { getOptionalInput, getRequiredInput } from "./actions-util";
1312
import * as api from "./api-client";
1413
import { getGitHubVersion, wrapApiConfigurationError } from "./api-client";
1514
import { CodeQL, getCodeQL } from "./codeql";
@@ -266,8 +265,8 @@ async function combineSarifFilesUsingCLI(
266265
);
267266

268267
const apiDetails = {
269-
auth: getRequiredInput("token"),
270-
externalRepoAuth: getOptionalInput("external-repository-token"),
268+
auth: actionsUtil.getRequiredInput("token"),
269+
externalRepoAuth: actionsUtil.getOptionalInput("external-repository-token"),
271270
url: getRequiredEnvParam("GITHUB_SERVER_URL"),
272271
apiURL: getRequiredEnvParam("GITHUB_API_URL"),
273272
};

src/util.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,10 @@ const shortTime = 10;
300300
test("withTimeout on long task", async (t) => {
301301
let longTaskTimedOut = false;
302302
const longTask = new Promise((resolve) => {
303-
setTimeout(() => {
303+
const timer = setTimeout(() => {
304304
resolve(42);
305305
}, longTime);
306+
t.teardown(() => clearTimeout(timer));
306307
});
307308
const result = await util.withTimeout(shortTime, longTask, () => {
308309
longTaskTimedOut = true;

0 commit comments

Comments
 (0)