From bc0f3fe427626bb3253c790898770f16701a512a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 29 Sep 2023 10:02:37 -0300 Subject: test: tidy output-checking syntax --- .../common-utilities/withPropertyFromObject.js | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/test/unit/data/composite/common-utilities/withPropertyFromObject.js b/test/unit/data/composite/common-utilities/withPropertyFromObject.js index c0e3dcc..1148722 100644 --- a/test/unit/data/composite/common-utilities/withPropertyFromObject.js +++ b/test/unit/data/composite/common-utilities/withPropertyFromObject.js @@ -46,7 +46,7 @@ t.test(`withPropertyFromObject: basic behavior`, t => { }); t.test(`withPropertyFromObject: output shapes & values`, t => { - t.plan(3 * 3 * 2); + t.plan(2 * 3 ** 2); const dependencies = { ['object_dependency']: @@ -59,7 +59,7 @@ t.test(`withPropertyFromObject: output shapes & values`, t => { 'baz', }; - const map = [ + const mapLevel1 = [ ['object_dependency', [ ['property_dependency', { '#value': 'apple', @@ -94,31 +94,32 @@ t.test(`withPropertyFromObject: output shapes & values`, t => { }]]], ]; - for (const [objectInput, submap] of map) { - for (const [propertyInput, dict] of submap) { + for (const [objectInput, mapLevel2] of mapLevel1) { + for (const [propertyInput, outputDict] of mapLevel2) { const step = withPropertyFromObject({ object: objectInput, property: propertyInput, }); - t.same( - Object.keys(step.toDescription().outputs), - Object.keys(dict)); - - const composite = compositeFrom({ - compose: false, + quickCheckOutputs(step, outputDict); + } + } - steps: [ - step, + function quickCheckOutputs(step, outputDict) { + t.same( + Object.keys(step.toDescription().outputs), + Object.keys(outputDict)); - { - dependencies: Object.keys(dict), - compute: dependencies => dependencies, - }, - ], - }); + const composite = compositeFrom({ + compose: false, + steps: [step, { + dependencies: Object.keys(outputDict), + compute: dependencies => dependencies, + }], + }); - t.same(composite.expose.compute(dependencies), dict); - } + t.same( + composite.expose.compute(dependencies), + outputDict); } }); -- cgit 1.3.0-6-gf8a5