mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 09:51:11 +00:00
Added a different message if the account is free tier (#69)
* Added a different upsell message if the account is free tier * Fixing prettier and unit tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import * as Constants from "../../Common/Constants";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import Explorer from "../Explorer";
|
||||
import AddDatabasePane from "./AddDatabasePane";
|
||||
@@ -5,6 +6,37 @@ import AddDatabasePane from "./AddDatabasePane";
|
||||
describe("Add Database Pane", () => {
|
||||
describe("getSharedThroughputDefault()", () => {
|
||||
let explorer: ViewModels.Explorer;
|
||||
const mockDatabaseAccount: ViewModels.DatabaseAccount = {
|
||||
id: "mock",
|
||||
kind: "DocumentDB",
|
||||
location: "",
|
||||
name: "mock",
|
||||
properties: {
|
||||
documentEndpoint: "",
|
||||
cassandraEndpoint: "",
|
||||
gremlinEndpoint: "",
|
||||
tableEndpoint: "",
|
||||
enableFreeTier: false
|
||||
},
|
||||
type: undefined,
|
||||
tags: []
|
||||
};
|
||||
|
||||
const mockFreeTierDatabaseAccount: ViewModels.DatabaseAccount = {
|
||||
id: "mock",
|
||||
kind: "DocumentDB",
|
||||
location: "",
|
||||
name: "mock",
|
||||
properties: {
|
||||
documentEndpoint: "",
|
||||
cassandraEndpoint: "",
|
||||
gremlinEndpoint: "",
|
||||
tableEndpoint: "",
|
||||
enableFreeTier: true
|
||||
},
|
||||
type: undefined,
|
||||
tags: []
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
explorer = new Explorer({
|
||||
@@ -43,5 +75,23 @@ describe("Add Database Pane", () => {
|
||||
const addDatabasePane = explorer.addDatabasePane as AddDatabasePane;
|
||||
expect(addDatabasePane.getSharedThroughputDefault()).toBe(true);
|
||||
});
|
||||
|
||||
it("should display free tier text in upsell messaging", () => {
|
||||
explorer.databaseAccount(mockFreeTierDatabaseAccount);
|
||||
const addDatabasePane = explorer.addDatabasePane as AddDatabasePane;
|
||||
expect(addDatabasePane.isFreeTierAccount()).toBe(true);
|
||||
expect(addDatabasePane.upsellMessage()).toContain("With free tier discount");
|
||||
expect(addDatabasePane.upsellAnchorUrl()).toBe(Constants.Urls.freeTierInformation);
|
||||
expect(addDatabasePane.upsellAnchorText()).toBe("Learn more");
|
||||
});
|
||||
|
||||
it("should display standard texr in upsell messaging", () => {
|
||||
explorer.databaseAccount(mockDatabaseAccount);
|
||||
const addDatabasePane = explorer.addDatabasePane as AddDatabasePane;
|
||||
expect(addDatabasePane.isFreeTierAccount()).toBe(false);
|
||||
expect(addDatabasePane.upsellMessage()).toContain("Start at");
|
||||
expect(addDatabasePane.upsellAnchorUrl()).toBe(Constants.Urls.cosmosPricing);
|
||||
expect(addDatabasePane.upsellAnchorText()).toBe("More details");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user