Skip to content

Commit e579cb2

Browse files
authored
Merge pull request #14 from vercel/add-computed-partition-key-test
add a test for pull/13
2 parents 0d3708a + 93d5ed1 commit e579cb2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/contains-partition-keys.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ function conditionKeyNodes(node: { [x: string]: any }): any[] {
2020

2121
function toPartitionKey(node: { [x: string]: any }): string | null {
2222
if (node.type === "scalar_member_expression") {
23-
return `${toPartitionKey(node.object) || ""}/${node.property.name || node.property.value}`;
23+
return `${toPartitionKey(node.object) || ""}/${node.property.name ||
24+
node.property.value}`;
2425
}
2526
return null;
2627
}

test/partition-keys.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ export const notContainsMultipleKeys = testPartitionKeys(
4545
);
4646

4747
export const empty = testPartitionKeys("SELECT * FROM c", []);
48+
49+
export const computedProperty = testPartitionKeys(
50+
'SELECT * FROM c WHERE c["partition"] = @pkValue',
51+
["/partition"],
52+
true
53+
);

0 commit comments

Comments
 (0)