mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-13 05:15:30 +00:00
* LMS Mongo Proxy support * change stirng to url for get mongo shell url * fix tests * enable feature flag * fixed unit test --------- Co-authored-by: Asier Isayas <aisayas@microsoft.com>
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import { Platform, resetConfigContext, updateConfigContext } from "../../../ConfigContext";
|
|
import { updateUserContext, userContext } from "../../../UserContext";
|
|
import { getMongoShellUrl } from "./getMongoShellUrl";
|
|
|
|
const mongoBackendEndpoint = "https://localhost:1234";
|
|
const hostedExplorerURL = "https://cosmos.azure.com/";
|
|
|
|
describe("getMongoShellUrl", () => {
|
|
let queryString = "";
|
|
|
|
beforeEach(() => {
|
|
resetConfigContext();
|
|
|
|
updateConfigContext({
|
|
BACKEND_ENDPOINT: mongoBackendEndpoint,
|
|
hostedExplorerURL: hostedExplorerURL,
|
|
platform: Platform.Hosted,
|
|
});
|
|
|
|
updateUserContext({
|
|
subscriptionId: "fakeSubscriptionId",
|
|
resourceGroup: "fakeResourceGroup",
|
|
databaseAccount: {
|
|
id: "fakeId",
|
|
name: "fakeName",
|
|
location: "fakeLocation",
|
|
type: "fakeType",
|
|
kind: "fakeKind",
|
|
properties: {
|
|
documentEndpoint: "fakeDocumentEndpoint",
|
|
tableEndpoint: "fakeTableEndpoint",
|
|
gremlinEndpoint: "fakeGremlinEndpoint",
|
|
cassandraEndpoint: "fakeCassandraEndpoint",
|
|
},
|
|
},
|
|
portalEnv: "prod",
|
|
});
|
|
|
|
queryString = `resourceId=${userContext.databaseAccount.id}&accountName=${userContext.databaseAccount.name}&mongoEndpoint=${userContext.databaseAccount.properties.documentEndpoint}`;
|
|
});
|
|
|
|
it("should return /indexv2.html by default", () => {
|
|
expect(getMongoShellUrl().toString()).toContain(`/indexv2.html?${queryString}`);
|
|
});
|
|
|
|
it("should return /index.html when useMongoProxyEndpoint is true", () => {
|
|
const useMongoProxyEndpoint: boolean = true;
|
|
expect(getMongoShellUrl(useMongoProxyEndpoint).toString()).toContain(`/index.html?${queryString}`);
|
|
});
|
|
});
|