Stub feature flag API endpoint in tests

This commit is contained in:
Henry Mercer 2021-12-16 13:30:31 +00:00
parent 6d62c245ec
commit 254816c2d2
12 changed files with 84 additions and 97 deletions

View file

@ -45,8 +45,7 @@ const util = __importStar(require("./util"));
.resolves({});
sinon.stub(actionsUtil, "sendStatusReport").resolves(true);
sinon.stub(configUtils, "getConfig").resolves({
// Use GHES so we don't try to call the feature flags API endpoint
gitHubVersion: { type: util.GitHubVariant.GHES, version: "3.0.0" },
gitHubVersion: { type: util.GitHubVariant.DOTCOM },
languages: [],
});
const requiredInputStub = sinon.stub(actionsUtil, "getRequiredInput");
@ -55,6 +54,7 @@ const util = __importStar(require("./util"));
const optionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
optionalInputStub.withArgs("cleanup-level").returns("none");
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, {});
process.env["CODEQL_THREADS"] = "1";
process.env["CODEQL_RAM"] = "4992";
// Action inputs have precedence over environment variables.