« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/unit/data
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/data')
-rw-r--r--test/unit/data/composite/common-utilities/withPropertyFromObject.js41
1 files 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 c0e3dccf..11487226 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);
   }
 });