mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-24 03:11:32 +00:00
- Load Legacy Mongo Shell V2 by default - Add/Keep feature flags to load from portal BE and V1 - Skip code coverage if skipCodeCoverage environment variable is set to "true"
87 lines
2.4 KiB
TypeScript
87 lines
2.4 KiB
TypeScript
import { extractFeatures } from "Platform/Hosted/extractFeatures";
|
|
import { configContext } from "../../../ConfigContext";
|
|
import { updateUserContext } from "../../../UserContext";
|
|
import { getMongoShellOrigin } from "./getMongoShellOrigin";
|
|
|
|
describe("getMongoShellOrigin", () => {
|
|
(window as { origin: string }).origin = "window_origin";
|
|
|
|
beforeEach(() => {
|
|
updateUserContext({
|
|
features: extractFeatures(
|
|
new URLSearchParams({
|
|
"feature.enableLegacyMongoShellV1": "false",
|
|
"feature.enableLegacyMongoShellV2": "false",
|
|
"feature.enableLegacyMongoShellV1Debug": "false",
|
|
"feature.enableLegacyMongoShellV2Debug": "false",
|
|
"feature.loadLegacyMongoShellFromBE": "false",
|
|
})
|
|
),
|
|
});
|
|
});
|
|
|
|
it("should return by default", () => {
|
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
|
});
|
|
|
|
it("should return window.origin when enableLegacyMongoShellV1", () => {
|
|
updateUserContext({
|
|
features: extractFeatures(
|
|
new URLSearchParams({
|
|
"feature.enableLegacyMongoShellV1": "true",
|
|
})
|
|
),
|
|
});
|
|
|
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
|
});
|
|
|
|
it("should return window.origin when enableLegacyMongoShellV2===true", () => {
|
|
updateUserContext({
|
|
features: extractFeatures(
|
|
new URLSearchParams({
|
|
"feature.enableLegacyMongoShellV2": "true",
|
|
})
|
|
),
|
|
});
|
|
|
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
|
});
|
|
|
|
it("should return window.origin when enableLegacyMongoShellV1Debug===true", () => {
|
|
updateUserContext({
|
|
features: extractFeatures(
|
|
new URLSearchParams({
|
|
"feature.enableLegacyMongoShellV1Debug": "true",
|
|
})
|
|
),
|
|
});
|
|
|
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
|
});
|
|
|
|
it("should return window.origin when enableLegacyMongoShellV2Debug===true", () => {
|
|
updateUserContext({
|
|
features: extractFeatures(
|
|
new URLSearchParams({
|
|
"feature.enableLegacyMongoShellV2Debug": "true",
|
|
})
|
|
),
|
|
});
|
|
|
|
expect(getMongoShellOrigin()).toBe(window.origin);
|
|
});
|
|
|
|
it("should return BACKEND_ENDPOINT when loadLegacyMongoShellFromBE===true", () => {
|
|
updateUserContext({
|
|
features: extractFeatures(
|
|
new URLSearchParams({
|
|
"feature.loadLegacyMongoShellFromBE": "true",
|
|
})
|
|
),
|
|
});
|
|
|
|
expect(getMongoShellOrigin()).toBe(configContext.BACKEND_ENDPOINT);
|
|
});
|
|
});
|