mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-04 16:51:19 +00:00
Add support for multi-partition key (#1252)
This commit is contained in:
@@ -37,7 +37,8 @@ describe("Collection", () => {
|
||||
version: 2,
|
||||
});
|
||||
collection = generateMockCollectionWithDataModel(collectionsDataModel);
|
||||
expect(collection.partitionKeyProperty).toBe("somePartitionKey.anotherPartitionKey");
|
||||
expect(collection.partitionKeyProperties.length).toBe(1);
|
||||
expect(collection.partitionKeyProperties[0]).toBe("somePartitionKey.anotherPartitionKey");
|
||||
});
|
||||
|
||||
it("should strip out forward slashes from single partition key paths", () => {
|
||||
@@ -47,7 +48,8 @@ describe("Collection", () => {
|
||||
version: 2,
|
||||
});
|
||||
collection = generateMockCollectionWithDataModel(collectionsDataModel);
|
||||
expect(collection.partitionKeyProperty).toBe("somePartitionKey");
|
||||
expect(collection.partitionKeyProperties.length).toBe(1);
|
||||
expect(collection.partitionKeyProperties[0]).toBe("somePartitionKey");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -61,7 +63,8 @@ describe("Collection", () => {
|
||||
version: 2,
|
||||
});
|
||||
collection = generateMockCollectionWithDataModel(collectionsDataModel);
|
||||
expect(collection.partitionKeyPropertyHeader).toBe("/somePartitionKey/anotherPartitionKey");
|
||||
expect(collection.partitionKeyPropertyHeaders.length).toBe(1);
|
||||
expect(collection.partitionKeyPropertyHeaders[0]).toBe("/somePartitionKey/anotherPartitionKey");
|
||||
});
|
||||
|
||||
it("should preserve forward slash on a single partition key", () => {
|
||||
@@ -71,7 +74,8 @@ describe("Collection", () => {
|
||||
version: 2,
|
||||
});
|
||||
collection = generateMockCollectionWithDataModel(collectionsDataModel);
|
||||
expect(collection.partitionKeyPropertyHeader).toBe("/somePartitionKey");
|
||||
expect(collection.partitionKeyPropertyHeaders.length).toBe(1);
|
||||
expect(collection.partitionKeyPropertyHeaders[0]).toBe("/somePartitionKey");
|
||||
});
|
||||
|
||||
it("should be null if there is no partition key", () => {
|
||||
@@ -81,7 +85,7 @@ describe("Collection", () => {
|
||||
kind: "Hash",
|
||||
});
|
||||
collection = generateMockCollectionWithDataModel(collectionsDataModel);
|
||||
expect(collection.partitionKeyPropertyHeader).toBeNull();
|
||||
expect(collection.partitionKeyPropertyHeaders.length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user