diff options
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/composite.js | 33 | ||||
-rw-r--r-- | test/lib/index.js | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/test/lib/composite.js b/test/lib/composite.js new file mode 100644 index 00000000..359d364d --- /dev/null +++ b/test/lib/composite.js @@ -0,0 +1,33 @@ +import {compositeFrom} from '#composite'; + +export function quickCheckCompositeOutputs(t, dependencies) { + return (step, outputDict) => { + t.same( + Object.keys(step.toDescription().outputs), + Object.keys(outputDict)); + + const composite = compositeFrom({ + compose: false, + steps: [ + step, + + { + dependencies: Object.keys(outputDict), + + // Access all dependencies by their expected keys - + // the composition runner actually provides a proxy + // and is checking that *we* access the dependencies + // we've specified. + compute: dependencies => + Object.fromEntries( + Object.keys(outputDict) + .map(key => [key, dependencies[key]])), + }, + ], + }); + + t.same( + composite.expose.compute(dependencies), + outputDict); + }; +} diff --git a/test/lib/index.js b/test/lib/index.js index 5fb5bf78..4c9ee23f 100644 --- a/test/lib/index.js +++ b/test/lib/index.js @@ -1,5 +1,6 @@ Error.stackTraceLimit = Infinity; +export * from './composite.js'; export * from './content-function.js'; export * from './generic-mock.js'; export * from './wiki-data.js'; |