Stub feature flag API endpoint in tests
This commit is contained in:
parent
6d62c245ec
commit
254816c2d2
12 changed files with 84 additions and 97 deletions
|
|
@ -4,7 +4,11 @@ import * as sinon from "sinon";
|
|||
import * as actionsUtil from "./actions-util";
|
||||
import * as analyze from "./analyze";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { setupTests, setupActionsVars } from "./testing-utils";
|
||||
import {
|
||||
setupTests,
|
||||
setupActionsVars,
|
||||
mockFeatureFlagApiEndpoint,
|
||||
} from "./testing-utils";
|
||||
import * as util from "./util";
|
||||
|
||||
setupTests(test);
|
||||
|
|
@ -25,8 +29,7 @@ test("analyze action with RAM & threads from environment variables", async (t) =
|
|||
.resolves({} as actionsUtil.StatusReportBase);
|
||||
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: [],
|
||||
} as unknown as configUtils.Config);
|
||||
const requiredInputStub = sinon.stub(actionsUtil, "getRequiredInput");
|
||||
|
|
@ -35,6 +38,7 @@ test("analyze action with RAM & threads from environment variables", async (t) =
|
|||
const optionalInputStub = sinon.stub(actionsUtil, "getOptionalInput");
|
||||
optionalInputStub.withArgs("cleanup-level").returns("none");
|
||||
setupActionsVars(tmpDir, tmpDir);
|
||||
mockFeatureFlagApiEndpoint(200, {});
|
||||
|
||||
// When there are no action inputs for RAM and threads, the action uses
|
||||
// environment variables (passed down from the init action) to set RAM and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue