Add support for multi-partition key (#1252)

This commit is contained in:
victor-meng
2022-04-21 13:37:02 -07:00
committed by GitHub
parent 9e7bbcfab6
commit 22f7d588a1
21 changed files with 175 additions and 158 deletions

View File

@@ -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);
});
});
});