Skip to content

Commit b779832

Browse files
committed
Fix permutations comment
1 parent 549683c commit b779832

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/json/testing-util.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,17 @@ export function withSchemaMatrix<S extends json.Schema>(
6161
`value-for-${String(key)}`,
6262
];
6363

64-
// Constructs an array of test objects, starting with `required` and adding
65-
// acceptable values for any
64+
// Constructs an array of test objects, starting with `required` and combining it with all
65+
// possible states of each optional property. For example, with default settings:
66+
//
67+
// For { requiredKey: string }, we get: `[{ requiredKey: "some-string-value" }]`
68+
//
69+
// For { requiredKey: string, optionalKey?: string }, we get:
70+
// [ { requiredKey: "some-string-value" },
71+
// { requiredKey: "some-string-value", optionalKey: undefined },
72+
// { requiredKey: "some-string-value", optionalKey: null },
73+
// { requiredKey: "some-string-value", optionalKey: "some-value" },
74+
// ]
6675
const permutations = (keys: Array<keyof S>) => {
6776
if (keys.length === 0) return [required];
6877

0 commit comments

Comments
 (0)