Remove tests that require us to have at least one feature with a toolsVersion

If no features have a `toolsVersion` property, we'll never hit those code paths, so it isn't that important to test them.
Having a synthetic feature is an option but might create user confusion.
This commit is contained in:
Henry Mercer 2024-06-26 19:46:03 +01:00
parent a52b209ec8
commit 8a9ecdff2e
3 changed files with 1 additions and 37 deletions

View file

@ -196,18 +196,6 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
});
}
}
// If we ever run into a situation where we no longer have any features that
// specify a minimum version or required tools feature, then we will have a
// bunch of code no longer being tested. This is unlikely, and this test will
// fail if that happens.
// If we do end up in that situation, then we should consider adding a synthetic
// feature with a minimum version that is only used for tests.
(0, ava_1.default)("At least one feature has a minimum version specified", (t) => {
t.assert(Object.values(feature_flags_1.featureConfig).some((f) => f.minimumVersion !== undefined), "At least one feature should have a minimum version specified");
t.assert(Object.values(feature_flags_1.featureConfig).some((f) => f.toolsFeature !== undefined), "At least one feature should have a required tools feature specified");
// An even less likely scenario is that we no longer have any features.
t.assert(Object.values(feature_flags_1.featureConfig).length > 0, "There should be at least one feature");
});
(0, ava_1.default)("Feature flags are saved to disk", async (t) => {
await (0, util_1.withTmpDir)(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir);

File diff suppressed because one or more lines are too long

View file

@ -285,30 +285,6 @@ for (const feature of Object.keys(featureConfig)) {
}
}
// If we ever run into a situation where we no longer have any features that
// specify a minimum version or required tools feature, then we will have a
// bunch of code no longer being tested. This is unlikely, and this test will
// fail if that happens.
// If we do end up in that situation, then we should consider adding a synthetic
// feature with a minimum version that is only used for tests.
test("At least one feature has a minimum version specified", (t) => {
t.assert(
Object.values(featureConfig).some((f) => f.minimumVersion !== undefined),
"At least one feature should have a minimum version specified",
);
t.assert(
Object.values(featureConfig).some((f) => f.toolsFeature !== undefined),
"At least one feature should have a required tools feature specified",
);
// An even less likely scenario is that we no longer have any features.
t.assert(
Object.values(featureConfig).length > 0,
"There should be at least one feature",
);
});
test("Feature flags are saved to disk", async (t) => {
await withTmpDir(async (tmpDir) => {
const features = setUpFeatureFlagTests(tmpDir);