Remove Explorer.defaultExperience

This commit is contained in:
hardiknai-techm
2021-04-15 13:04:51 +05:30
parent f94f95e788
commit 8f0bb1add8
6 changed files with 37 additions and 23 deletions

View File

@@ -1,7 +1,8 @@
import * as Constants from "../../Common/Constants";
import AddCollectionPane from "./AddCollectionPane";
import Explorer from "../Explorer";
import { DatabaseAccount } from "../../Contracts/DataModels";
import { updateUserContext } from "../../UserContext";
import Explorer from "../Explorer";
import AddCollectionPane from "./AddCollectionPane";
describe("Add Collection Pane", () => {
describe("isValid()", () => {
@@ -43,14 +44,26 @@ describe("Add Collection Pane", () => {
});
it("should be true if graph API and partition key is not /id nor /label", () => {
explorer.defaultExperience(Constants.DefaultAccountExperience.Graph.toLowerCase());
updateUserContext({
databaseAccount: {
properties: {
capabilities: [{ name: "EnableGremlin" }],
},
} as DatabaseAccount,
});
const addCollectionPane = explorer.addCollectionPane as AddCollectionPane;
addCollectionPane.partitionKey("/blah");
expect(addCollectionPane.isValid()).toBe(true);
});
it("should be false if graph API and partition key is /id or /label", () => {
explorer.defaultExperience(Constants.DefaultAccountExperience.Graph.toLowerCase());
updateUserContext({
databaseAccount: {
properties: {
capabilities: [{ name: "EnableGremlin" }],
},
} as DatabaseAccount,
});
const addCollectionPane = explorer.addCollectionPane as AddCollectionPane;
addCollectionPane.partitionKey("/id");
expect(addCollectionPane.isValid()).toBe(false);
@@ -60,7 +73,7 @@ describe("Add Collection Pane", () => {
});
it("should be true for any non-graph API with /id or /label partition key", () => {
explorer.defaultExperience(Constants.DefaultAccountExperience.DocumentDB.toLowerCase());
updateUserContext({});
const addCollectionPane = explorer.addCollectionPane as AddCollectionPane;
addCollectionPane.partitionKey("/id");

View File

@@ -486,7 +486,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
userContext.portalEnv,
this.isFreeTierAccount(),
this.container.isFirstResourceCreated(),
this.container.defaultExperience(),
userContext.apiType,
true
);
});

View File

@@ -238,7 +238,7 @@ export default class AddDatabasePane extends ContextualPaneBase {
userContext.portalEnv,
this.isFreeTierAccount(),
this.container.isFirstResourceCreated(),
this.container.defaultExperience(),
userContext.apiType,
false
);
});