From b77983290b283ad7a760a3981c5eb9da3ba05629 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Thu, 30 Apr 2026 13:28:42 +0100 Subject: [PATCH] Fix `permutations` comment --- src/json/testing-util.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/json/testing-util.ts b/src/json/testing-util.ts index c534262b8..18c1bf06e 100644 --- a/src/json/testing-util.ts +++ b/src/json/testing-util.ts @@ -61,8 +61,17 @@ export function withSchemaMatrix( `value-for-${String(key)}`, ]; - // Constructs an array of test objects, starting with `required` and adding - // acceptable values for any + // Constructs an array of test objects, starting with `required` and combining it with all + // possible states of each optional property. For example, with default settings: + // + // For { requiredKey: string }, we get: `[{ requiredKey: "some-string-value" }]` + // + // For { requiredKey: string, optionalKey?: string }, we get: + // [ { requiredKey: "some-string-value" }, + // { requiredKey: "some-string-value", optionalKey: undefined }, + // { requiredKey: "some-string-value", optionalKey: null }, + // { requiredKey: "some-string-value", optionalKey: "some-value" }, + // ] const permutations = (keys: Array) => { if (keys.length === 0) return [required];