mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-13 07:57:26 +01:00
clean up tests
This commit is contained in:
@@ -95,9 +95,6 @@ const createSqlContainer = async (params: DataModels.CreateCollectionParams): Pr
|
|||||||
const resource: ARMTypes.SqlContainerResource = {
|
const resource: ARMTypes.SqlContainerResource = {
|
||||||
id: params.collectionId,
|
id: params.collectionId,
|
||||||
};
|
};
|
||||||
if (params.analyticalStorageTtl) {
|
|
||||||
resource.analyticalStorageTtl = params.analyticalStorageTtl;
|
|
||||||
}
|
|
||||||
if (params.indexingPolicy) {
|
if (params.indexingPolicy) {
|
||||||
resource.indexingPolicy = params.indexingPolicy;
|
resource.indexingPolicy = params.indexingPolicy;
|
||||||
}
|
}
|
||||||
@@ -138,9 +135,6 @@ const createMongoCollection = async (params: DataModels.CreateCollectionParams):
|
|||||||
const resource: ARMTypes.MongoDBCollectionResource = {
|
const resource: ARMTypes.MongoDBCollectionResource = {
|
||||||
id: params.collectionId,
|
id: params.collectionId,
|
||||||
};
|
};
|
||||||
if (params.analyticalStorageTtl) {
|
|
||||||
resource.analyticalStorageTtl = params.analyticalStorageTtl;
|
|
||||||
}
|
|
||||||
if (params.partitionKey) {
|
if (params.partitionKey) {
|
||||||
const partitionKeyPath: string = params.partitionKey.paths[0];
|
const partitionKeyPath: string = params.partitionKey.paths[0];
|
||||||
resource.shardKey = { [partitionKeyPath]: "Hash" };
|
resource.shardKey = { [partitionKeyPath]: "Hash" };
|
||||||
@@ -179,9 +173,6 @@ const createCassandraTable = async (params: DataModels.CreateCollectionParams):
|
|||||||
const resource: ARMTypes.CassandraTableResource = {
|
const resource: ARMTypes.CassandraTableResource = {
|
||||||
id: params.collectionId,
|
id: params.collectionId,
|
||||||
};
|
};
|
||||||
if (params.analyticalStorageTtl) {
|
|
||||||
resource.analyticalStorageTtl = params.analyticalStorageTtl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rpPayload: ARMTypes.CassandraTableCreateUpdateParameters = {
|
const rpPayload: ARMTypes.CassandraTableCreateUpdateParameters = {
|
||||||
properties: {
|
properties: {
|
||||||
@@ -282,7 +273,6 @@ const createCollectionWithSDK = async (params: DataModels.CreateCollectionParams
|
|||||||
partitionKey: params.partitionKey || undefined,
|
partitionKey: params.partitionKey || undefined,
|
||||||
indexingPolicy: params.indexingPolicy || undefined,
|
indexingPolicy: params.indexingPolicy || undefined,
|
||||||
uniqueKeyPolicy: params.uniqueKeyPolicy || undefined,
|
uniqueKeyPolicy: params.uniqueKeyPolicy || undefined,
|
||||||
analyticalStorageTtl: params.analyticalStorageTtl,
|
|
||||||
vectorEmbeddingPolicy: params.vectorEmbeddingPolicy,
|
vectorEmbeddingPolicy: params.vectorEmbeddingPolicy,
|
||||||
fullTextPolicy: params.fullTextPolicy,
|
fullTextPolicy: params.fullTextPolicy,
|
||||||
} as ContainerRequest; // TODO: remove cast when https://github.com/Azure/azure-cosmos-js/issues/423 is fixed
|
} as ContainerRequest; // TODO: remove cast when https://github.com/Azure/azure-cosmos-js/issues/423 is fixed
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ export const createGlobalSecondaryIndex = async (params: CreateGlobalSecondaryIn
|
|||||||
if (params.materializedViewDefinition) {
|
if (params.materializedViewDefinition) {
|
||||||
resource.materializedViewDefinition = params.materializedViewDefinition;
|
resource.materializedViewDefinition = params.materializedViewDefinition;
|
||||||
}
|
}
|
||||||
if (params.analyticalStorageTtl) {
|
|
||||||
resource.analyticalStorageTtl = params.analyticalStorageTtl;
|
|
||||||
}
|
|
||||||
if (params.indexingPolicy) {
|
if (params.indexingPolicy) {
|
||||||
resource.indexingPolicy = params.indexingPolicy;
|
resource.indexingPolicy = params.indexingPolicy;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,58 +14,6 @@ describe("CommandBarComponentButtonFactory tests", () => {
|
|||||||
|
|
||||||
afterEach(() => useSelectedNode.getState().setSelectedNode(undefined));
|
afterEach(() => useSelectedNode.getState().setSelectedNode(undefined));
|
||||||
|
|
||||||
describe("Enable Azure Synapse Link Button", () => {
|
|
||||||
const enableAzureSynapseLinkBtnLabel = "Enable Azure Synapse Link";
|
|
||||||
const selectedNodeState = useSelectedNode.getState();
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
mockExplorer = {} as Explorer;
|
|
||||||
updateUserContext({
|
|
||||||
databaseAccount: {
|
|
||||||
properties: {
|
|
||||||
capabilities: [{ name: "EnableMongo" }],
|
|
||||||
},
|
|
||||||
} as DatabaseAccount,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO: Now that Tables API supports dataplane RBAC, calling createStaticCommandBarButtons will enable the
|
|
||||||
// Entra ID Login button, which causes this test to fail due to "Invalid hook call.". This seems to be
|
|
||||||
// unsupported in jest and needs to be tested with react-hooks-testing-library.
|
|
||||||
//
|
|
||||||
// it("Button should not be visible for Tables API", () => {
|
|
||||||
// updateUserContext({
|
|
||||||
// databaseAccount: {
|
|
||||||
// properties: {
|
|
||||||
// capabilities: [{ name: "EnableTable" }],
|
|
||||||
// },
|
|
||||||
// } as DatabaseAccount,
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
|
||||||
// const enableAzureSynapseLinkBtn = buttons.find(
|
|
||||||
// (button) => button.commandButtonLabel === enableAzureSynapseLinkBtnLabel,
|
|
||||||
// );
|
|
||||||
// expect(enableAzureSynapseLinkBtn).toBeUndefined();
|
|
||||||
//});
|
|
||||||
|
|
||||||
it("Button should not be visible for Cassandra API", () => {
|
|
||||||
updateUserContext({
|
|
||||||
databaseAccount: {
|
|
||||||
properties: {
|
|
||||||
capabilities: [{ name: "EnableCassandra" }],
|
|
||||||
},
|
|
||||||
} as DatabaseAccount,
|
|
||||||
});
|
|
||||||
|
|
||||||
const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState);
|
|
||||||
const enableAzureSynapseLinkBtn = buttons.find(
|
|
||||||
(button) => button.commandButtonLabel === enableAzureSynapseLinkBtnLabel,
|
|
||||||
);
|
|
||||||
expect(enableAzureSynapseLinkBtn).toBeUndefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("Open Cassandra shell button", () => {
|
describe("Open Cassandra shell button", () => {
|
||||||
const openCassandraShellBtnLabel = "Open Cassandra shell";
|
const openCassandraShellBtnLabel = "Open Cassandra shell";
|
||||||
const selectedNodeState = useSelectedNode.getState();
|
const selectedNodeState = useSelectedNode.getState();
|
||||||
|
|||||||
Reference in New Issue
Block a user