Cover all cases of URIs and feature flags

This commit is contained in:
Robert
2024-04-17 10:53:17 +01:00
parent b3fdb3a126
commit 2f67ccea56

View File

@@ -10,7 +10,15 @@ describe("checkVariantAnalysisEnabled", () => {
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(true); expect(isVariantAnalysisEnabledForGitHubHost()).toBe(true);
}); });
it("returns false when GHES enterprise URI is set", async () => { it("returns false when GHES enterprise URI is set and variant analysis feature flag is not set", async () => {
await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue(
"https://github.example.com",
ConfigurationTarget.Global,
);
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(false);
});
it("returns false when GHES enterprise URI is set and variant analysis feature flag is set", async () => {
await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue( await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue(
"https://github.example.com", "https://github.example.com",
ConfigurationTarget.Global, ConfigurationTarget.Global,
@@ -22,9 +30,9 @@ describe("checkVariantAnalysisEnabled", () => {
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(false); expect(isVariantAnalysisEnabledForGitHubHost()).toBe(false);
}); });
it("returns false when GHEC-DR URI is set but variant analysis feature flag is not set", async () => { it("returns false when GHEC-DR URI is set and variant analysis feature flag is not set", async () => {
await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue( await VSCODE_GITHUB_ENTERPRISE_URI_SETTING.updateValue(
"https://github.example.com", "https://example.ghe.com",
ConfigurationTarget.Global, ConfigurationTarget.Global,
); );
expect(isVariantAnalysisEnabledForGitHubHost()).toBe(false); expect(isVariantAnalysisEnabledForGitHubHost()).toBe(false);