From f3d98f5ea63db7f7b2155e7efb0812f025c5bcf3 Mon Sep 17 00:00:00 2001
From: "(quasar) nebula" <qznebula@protonmail.com>
Date: Sat, 23 Sep 2023 20:35:57 -0300
Subject: data, test: collate update description from composition inputs

---
 test/unit/data/composite/compositeFrom.js | 52 +++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

(limited to 'test/unit/data/composite')

diff --git a/test/unit/data/composite/compositeFrom.js b/test/unit/data/composite/compositeFrom.js
index faeef59a..6ae1e7bc 100644
--- a/test/unit/data/composite/compositeFrom.js
+++ b/test/unit/data/composite/compositeFrom.js
@@ -172,7 +172,7 @@ t.test(`compositeFrom: dependencies from inputs`, t => {
 });
 
 t.test(`compositeFrom: update from various sources`, t => {
-  t.plan(2);
+  t.plan(3);
 
   const match = {
     flags: {update: true, expose: true, compose: false},
@@ -232,6 +232,54 @@ t.test(`compositeFrom: update from various sources`, t => {
     });
 
     t.match(composite, match);
-    t.equal(debugComposite(() => composite.expose.transform('foo')), 'Xx_foofoo_xX');
+    t.equal(composite.expose.transform('foo'), 'Xx_foofoo_xX');
+  });
+
+  t.test(`compositeFrom: update from inputs`, t => {
+    t.plan(3);
+
+    const composite = compositeFrom({
+      inputs: {
+        myInput: input.updateValue({
+          validate: isString,
+          default: 'foo',
+        }),
+      },
+
+      steps: [
+        {
+          dependencies: [input('myInput')],
+          compute: (continuation, {
+            [input('myInput')]: value,
+          }) => continuation({
+            '#value': `Xx_${value.repeat(2)}_xX`,
+          }),
+        },
+
+        {
+          dependencies: ['#value'],
+          transform: (_value, continuation, {'#value': value}) =>
+            continuation(value),
+        },
+      ],
+    });
+
+    let continuationValue = null;
+    const continuation = value => {
+      continuationValue = value;
+      return continuationSymbol;
+    };
+
+    t.match(composite, {
+      ...match,
+
+      flags: {update: true, expose: true, compose: true},
+    });
+
+    t.equal(
+      composite.expose.transform('foo', continuation),
+      continuationSymbol);
+
+    t.equal(continuationValue, 'Xx_foofoo_xX');
   });
 });
-- 
cgit 1.3.0-6-gf8a5