mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 09:51:11 +00:00
MongoClient Feature Flag (#1073)
Adding a feature flag for Mongo Client that allows a user to specify a mongo endpoint and an API so that users can test specific APIs locally. Example: https://localhost:1234/hostedExplorer.html?feature.mongoproxyendpoint=https://localhost:12901&feature.mongoProxyAPIs=createDocument|readDocument The above link says to test APIs createDocument and readDocument on https://localhost:12901 Co-authored-by: artrejo <ato9000@users.noreply.github.com> Co-authored-by: Asier Isayas <aisayas@microsoft.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { extractFeatures } from "./extractFeatures";
|
||||
import { extractFeatures, hasFlag } from "./extractFeatures";
|
||||
|
||||
describe("extractFeatures", () => {
|
||||
it("correctly detects feature flags in a case insensitive manner", () => {
|
||||
@@ -14,9 +14,24 @@ describe("extractFeatures", () => {
|
||||
});
|
||||
|
||||
const features = extractFeatures(params);
|
||||
|
||||
expect(features.notebookServerUrl).toBe(url);
|
||||
expect(features.notebookServerToken).toBe(token);
|
||||
expect(features.enableNotebooks).toBe(notebooksEnabled);
|
||||
});
|
||||
});
|
||||
|
||||
describe("hasFlag", () => {
|
||||
it("correctly determines if value has flag", () => {
|
||||
const desiredFlag = "readDocument";
|
||||
|
||||
const singleFlagValue = "readDocument";
|
||||
const multipleFlagValues = "readDocument|createDocument";
|
||||
const differentFlagValue = "createDocument";
|
||||
|
||||
expect(hasFlag(singleFlagValue, desiredFlag)).toBe(true);
|
||||
expect(hasFlag(multipleFlagValues, desiredFlag)).toBe(true);
|
||||
expect(hasFlag(differentFlagValue, desiredFlag)).toBe(false);
|
||||
expect(hasFlag(multipleFlagValues, undefined)).toBe(false);
|
||||
expect(hasFlag(undefined, desiredFlag)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user