Extract GitHubFeatureFlags to a separate class

Internal refactoring so that `GitHubFeatureFlags` is
private only. The public facing class is `Features`.
This commit is contained in:
Andrew Eisenberg 2022-10-06 14:42:57 -07:00
parent 5915e70486
commit b27aed78f5
15 changed files with 149 additions and 110 deletions

View file

@ -123,7 +123,7 @@ for (const featureFlag of Object.keys(feature_flags_1.featureConfig)) {
const expectedFeatureFlags = initializeFeatures(true);
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureFlags);
await t.throwsAsync(async () => featureFlags.getValue(featureFlag), {
message: `A minimum version is specified for feature flag ${featureFlag}, but no instance of CodeQL was provided.`,
message: `Internal error: A minimum version is specified for feature flag ${featureFlag}, but no instance of CodeQL was provided.`,
});
});
});
@ -168,7 +168,7 @@ function initializeFeatures(initialValue) {
}
function setUpTests(tmpDir, logger = (0, logging_1.getRunnerLogger)(true), gitHubVersion = { type: util_1.GitHubVariant.DOTCOM }) {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
return new feature_flags_1.GitHubFeatureFlags(gitHubVersion, testApiDetails, testRepositoryNwo, logger);
return new feature_flags_1.Features(gitHubVersion, testApiDetails, testRepositoryNwo, logger);
}
function includeCodeQlIfRequired(featureFlag) {
return feature_flags_1.featureConfig[featureFlag].minimumVersion !== undefined