react 0.3.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +2 -1
- package/.travis.yml +4 -0
- package/Jakefile.js +34 -3
- package/README.md +34 -174
- package/browser-test/dist.html +90 -0
- package/browser-test/index.html +86 -0
- package/browser-test/min.html +90 -0
- package/dist/react.js +3291 -0
- package/dist/react.min.js +1 -0
- package/doc/advanced.md +166 -0
- package/doc/color-def.graffle +938 -0
- package/doc/color-def.png +0 -0
- package/doc/simple.dot +25 -0
- package/doc/simple.png +0 -0
- package/examples/{default1.js → longer-example.js} +0 -0
- package/examples/{default-simple.js → simple.js} +0 -0
- package/examples/{ast1.js → using-ast-directly.js} +4 -0
- package/examples/{default-events1.js → using-events1.js} +1 -1
- package/examples/{default-log-events.js → using-log-events.js} +1 -1
- package/lib/base-task.js +116 -110
- package/lib/cb-task.js +71 -67
- package/lib/core.js +120 -109
- package/lib/dsl.js +120 -115
- package/lib/error.js +44 -36
- package/lib/event-collector.js +81 -0
- package/lib/event-manager.js +66 -55
- package/lib/eventemitter.js +20 -0
- package/lib/finalcb-first-task.js +56 -53
- package/lib/finalcb-task.js +55 -51
- package/lib/id.js +18 -6
- package/lib/input-parser.js +49 -41
- package/lib/log-events.js +81 -60
- package/lib/parse.js +34 -25
- package/lib/promise-resolve.js +50 -0
- package/lib/promise-task.js +78 -74
- package/lib/react.js +59 -0
- package/lib/ret-task.js +59 -55
- package/lib/sprintf.js +18 -0
- package/lib/status.js +11 -2
- package/lib/task.js +219 -213
- package/lib/track-tasks.js +67 -110
- package/lib/validate.js +136 -136
- package/lib/vcon.js +78 -69
- package/lib/when-task.js +69 -65
- package/package.json +11 -9
- package/src/dist.build.requirejs +20 -0
- package/test/ast.mocha.js +136 -0
- package/test/cb-task.mocha.js +220 -0
- package/test/core-deferred.mocha.js +143 -0
- package/test/core-when.mocha.js +96 -0
- package/test/core.mocha.js +589 -0
- package/test/dsl.mocha.js +350 -0
- package/test/event-manager.mocha.js +119 -0
- package/test/exec-options.mocha.js +48 -0
- package/test/finalcb-task.mocha.js +58 -0
- package/test/input-parser.mocha.js +86 -0
- package/test/mocha.opts +2 -0
- package/test/module-use.mocha.js +147 -0
- package/test/promise-auto-resolve.mocha.js +68 -0
- package/test/ret-task.mocha.js +220 -0
- package/test/task.mocha.js +42 -0
- package/test/validate-cb-task.mocha.js +100 -0
- package/test/validate-ret-task.mocha.js +110 -0
- package/test/validate.mocha.js +324 -0
- package/test/vcon.mocha.js +193 -0
- package/vendor/chai/chai.js +2038 -0
- package/vendor/jquery/jquery-1.7.1.js +9266 -0
- package/vendor/jquery/jquery-1.7.1.min.js +4 -0
- package/vendor/mocha/mocha.css +135 -0
- package/vendor/mocha/mocha.js +3589 -0
- package/vendor/node/util.js +531 -0
- package/vendor/requirejs/require.js +2053 -0
- package/vendor/requirejs/require.min.js +33 -0
- package/doc/alternate-dsls.md +0 -103
- package/doc/default-simple.dot +0 -19
- package/doc/default-simple.dot.png +0 -0
- package/dsl/chain.js +0 -150
- package/dsl/fstr.js +0 -121
- package/dsl/pcode.js +0 -175
- package/examples/chain-events1.js +0 -55
- package/examples/chain1.js +0 -19
- package/examples/fstr-events1.js +0 -38
- package/examples/fstr1.js +0 -37
- package/examples/pcode1.js +0 -22
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia.html +0 -675
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/37px-Wiktionary-logo-en.svg.png +0 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/closewindow.png +0 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/index(1).php +0 -407
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/index.php +0 -130
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(1).php +0 -3
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(10).php +0 -89
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(2).php +0 -23
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(3).php +0 -153
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(4).php +0 -6
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(5).php +0 -3
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(6).php +0 -96
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(7).php +0 -16
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(8).php +0 -14
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(9).php +0 -123
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load.php +0 -3
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/poweredby_mediawiki_88x31.png +0 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/saved_resource +0 -1
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/search-ltr.png +0 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/wikimedia-button.png +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's.html +0 -1369
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/121911_DobbsDigest_Cover.jpg +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/160-x-600-IMU Impact 2012.jpg +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp= +0 -68
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(1) +0 -67
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(2) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(3) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(4) +0 -8
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(5) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461 +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(1) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(2) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(3) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(4) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(5) +0 -431
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(6) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(7) +0 -431
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(8) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(9) +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Ad0St1Sz6Sq0V0Id20628317.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Ad2331174St1Sz225Sq20825250V0Id4.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/AdTracImage.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Default_Size_16_1x1.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/FB.Share +0 -9
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/addthis_widget.js +0 -2
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/adlink_5242_1183459_0_154_AdId=2355270;BnId=1;itime=820768810;key=231400148+_database_231400148;link= +0 -11
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/beacon.js +0 -7
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/checkauth.js +0 -18
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/colorbox.css +0 -49
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/convert_data.js +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count(1).js +0 -5
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count.js +0 -5
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count.json +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dataflow1.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/def.html +0 -126
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/defaults.css +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/detect.js +0 -91
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/devtest_left-col-slim.css +0 -30
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqus.js +0 -327
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusHints.css +0 -34
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusHints.js +0 -8
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusLoggedOff(1).css +0 -24
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusLoggedOff.css +0 -24
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dobbs_disqus_logo.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dsqcd10c7f376188a4a2ca3e8fea2c03aeb.css +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dsqcd10c7f376188a4a2ca3e8fea2c03aeb.js +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/elqCfg.js +0 -55
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/elqImg.js +0 -12
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/embed.js +0 -76
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/experience_util.js +0 -636
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/fastbutton.html +0 -11
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/ga.js +0 -51
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-facebook_sm.png +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-nav.css +0 -798
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-twitter_sm.png +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h_s_code_remote.js +0 -377
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/hintbox_info.jpg +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/hub.1326407570.html +0 -3
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/in.js +0 -76
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/insight.min.js +0 -55
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-1.2.6.min.js +0 -32
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-1.4.2.min.js +0 -154
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-ui-1.8rc3.custom.min.js +0 -374
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery.colorbox-min.js +0 -4
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery.min.js +0 -154
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/lib.js +0 -212
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/like.html +0 -214
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/noavatar32.png +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/nodetag.js +0 -18
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/nonSecureAnonymousFramework +0 -2913
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/p.json +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/plusone.js +0 -32
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/popwindow.js +0 -24
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/q4OyybLB0-A.js +0 -91
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/quant.js +0 -28
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/qxvZoiHdpAF.css +0 -192
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/reply.html +0 -160
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/rss.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/s.js +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource +0 -421
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(1) +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(2) +0 -341
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(3) +0 -127
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/script84.js +0 -113
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/scripts.js +0 -30
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/sh72.html +0 -5
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shAutoloader.js +0 -17
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushAS3.js +0 -59
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushAppleScript.js +0 -75
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushBash.js +0 -59
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCSharp.js +0 -65
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushColdFusion.js +0 -100
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCpp.js +0 -97
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCss.js +0 -91
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushDelphi.js +0 -55
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushDiff.js +0 -41
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushErlang.js +0 -52
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushGroovy.js +0 -67
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJScript.js +0 -52
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJava.js +0 -57
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJavaFX.js +0 -58
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPerl.js +0 -72
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPhp.js +0 -88
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPlain.js +0 -33
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPowerShell.js +0 -74
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPython.js +0 -64
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushRuby.js +0 -55
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushSass.js +0 -94
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushScala.js +0 -51
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushSql.js +0 -66
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushVb.js +0 -56
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushXml.js +0 -69
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCore.css +0 -226
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCoreDefault.css +0 -333
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCore_new.js +0 -17
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shLegacy.js +0 -17
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shThemeDefault.css +0 -117
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share-button-css +0 -67
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share_email_icon.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share_print_icon.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/sidebar.js +0 -88
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/superfooter_936.css +0 -186
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/svrGP.aspx +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/t.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/thickbox.js +0 -343
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/thread.js +0 -128
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/togglediv.js +0 -15
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/tweet_button.html +0 -3
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/ubmtechweb_logo_sm.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/upload.html +0 -91
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/welcome.js +0 -7
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/widget74.css +0 -1
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/widgets.js +0 -40
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia.html +0 -904
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/50px-Question_book-new.svg.png +0 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/closewindow.png +0 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/index(1).php +0 -407
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/index.php +0 -130
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(1).php +0 -3
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(10).php +0 -89
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(2).php +0 -23
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(3).php +0 -153
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(4).php +0 -6
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(5).php +0 -3
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(6).php +0 -96
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(7).php +0 -16
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(8).php +0 -14
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(9).php +0 -123
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load.php +0 -3
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/poweredby_mediawiki_88x31.png +0 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/saved_resource +0 -1
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/search-ltr.png +0 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/wikimedia-button.png +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS.html +0 -113
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/6654_111305815684_541245684_2583159_5383291_n_normal.jpg +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/MARC3_normal.jpg +0 -2
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/beacon.js +0 -7
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/c953ddd239707998340e1a6fbb3eeb46 +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/c953ddd239707998340e1a6fbb3eeb46_normal.jpeg +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/clouds2_normal.jpg +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/count.json +0 -1
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/def.html +0 -126
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/defaults.css +0 -1
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/disqus.js +0 -327
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/dsq7884a9652e94555c70f96b6be63be216.css +0 -1
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/dsq7884a9652e94555c70f96b6be63be216.js +0 -66
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/embed.js +0 -76
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/example1.dot +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/ga.js +0 -51
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/get_num_replies.js +0 -79
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/hub.1326407570.html +0 -3
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/lib.js +0 -212
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/noavatar32.png +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/quant.js +0 -28
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/reply.html +0 -160
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/t.gif +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/thread.js +0 -128
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/tweet_button.1326407570.html +0 -3
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/twitter_normal.jpg +0 -2
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/upload.html +0 -91
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/widgets.js +0 -40
- package/jake-tasks/jake-test.js +0 -64
- package/promise-resolve.js +0 -35
- package/react.js +0 -8
- package/test/ast.test.js +0 -69
- package/test/cb-task.test.js +0 -197
- package/test/core-deferred.test.js +0 -134
- package/test/core-promised.test.js +0 -132
- package/test/core-when.test.js +0 -84
- package/test/core.test.js +0 -568
- package/test/dsl.test.js +0 -330
- package/test/dsl/chain.test.js +0 -324
- package/test/dsl/fstr.test.js +0 -300
- package/test/dsl/pcode.test.js +0 -448
- package/test/event-manager.test.js +0 -102
- package/test/exec-options.test.js +0 -33
- package/test/finalcb-task.test.js +0 -38
- package/test/input-parser.test.js +0 -66
- package/test/module-use.test.js +0 -131
- package/test/promise-auto-resolve.test.js +0 -51
- package/test/ret-task.test.js +0 -199
- package/test/task.test.js +0 -21
- package/test/validate-cb-task.test.js +0 -74
- package/test/validate-ret-task.test.js +0 -83
- package/test/validate.test.js +0 -295
- package/test/vcon.test.js +0 -173
package/test/dsl.test.js
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tap').test;
|
|
4
|
-
var sprintf = require('sprintf').sprintf;
|
|
5
|
-
|
|
6
|
-
var react = require('../'); // require('react');
|
|
7
|
-
|
|
8
|
-
function falpha() { }
|
|
9
|
-
function fbeta() { }
|
|
10
|
-
|
|
11
|
-
test('module exports is a fn with properties', function (t) {
|
|
12
|
-
t.type(react, 'function', 'has define by DSL method'); //
|
|
13
|
-
t.type(react.selectFirst, 'function', 'has selectFirst define method');
|
|
14
|
-
t.end();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('no arguments -> empty name, inParams, tasks, outTask', function (t) {
|
|
18
|
-
var r = react();
|
|
19
|
-
t.equal(r.ast.name, undefined);
|
|
20
|
-
t.deepEqual(r.ast.inParams, []);
|
|
21
|
-
t.deepEqual(r.ast.tasks, []);
|
|
22
|
-
t.deepEqual(r.ast.outTask, { a: [], type: 'finalcb' });
|
|
23
|
-
t.end();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
test('empty first string -> empty name, inParams, tasks, outTask', function (t) {
|
|
28
|
-
var r = react('');
|
|
29
|
-
t.equal(r.ast.name, '');
|
|
30
|
-
t.deepEqual(r.ast.inParams, []);
|
|
31
|
-
t.deepEqual(r.ast.tasks, []);
|
|
32
|
-
t.deepEqual(r.ast.outTask, { a: [], type: 'finalcb' });
|
|
33
|
-
t.end();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
test('single first string -> name, inParams["foo"], empty tasks, outTask', function (t) {
|
|
38
|
-
var r = react('foo');
|
|
39
|
-
t.equal(r.ast.name, 'foo');
|
|
40
|
-
t.deepEqual(r.ast.inParams, []);
|
|
41
|
-
t.deepEqual(r.ast.tasks, []);
|
|
42
|
-
t.deepEqual(r.ast.outTask, { a: [], type: 'finalcb' });
|
|
43
|
-
t.end();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('triple first string -> inParams["foo", "bar", "baz"], empty tasks, outTask',
|
|
47
|
-
function (t) {
|
|
48
|
-
var r = react('myName', ' foo, bar,baz ');
|
|
49
|
-
t.equal(r.ast.name, 'myName');
|
|
50
|
-
t.deepEqual(r.ast.inParams, ['foo', 'bar', 'baz']);
|
|
51
|
-
t.deepEqual(r.ast.tasks, []);
|
|
52
|
-
t.deepEqual(r.ast.outTask, { a: [], type: 'finalcb' });
|
|
53
|
-
t.end();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('single task, single out params', function (t) {
|
|
57
|
-
var r = react('myName', 'cb -> err, c',
|
|
58
|
-
falpha, 'cb -> err, c'
|
|
59
|
-
);
|
|
60
|
-
t.deepEqual(r.ast.inParams, []);
|
|
61
|
-
t.deepEqual(r.ast.tasks, [
|
|
62
|
-
{ f: falpha, a: [], out: ['c'], type: 'cb', name: 'falpha'}
|
|
63
|
-
]);
|
|
64
|
-
t.deepEqual(r.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
65
|
-
t.end();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('single task, err and out params', function (t) {
|
|
69
|
-
var r = react('myName', 'cb -> err, c',
|
|
70
|
-
falpha, 'cb -> err, c'
|
|
71
|
-
);
|
|
72
|
-
t.deepEqual(r.ast.inParams, []);
|
|
73
|
-
t.deepEqual(r.ast.tasks, [
|
|
74
|
-
{ f: falpha, a: [], out: ['c'], type: 'cb', name: 'falpha'}
|
|
75
|
-
]);
|
|
76
|
-
t.deepEqual(r.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
77
|
-
t.end();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('using - with literal string', function (t) {
|
|
81
|
-
var r = react('myName', '"hello-world", cb -> err, c',
|
|
82
|
-
falpha, '"another-string", cb -> err, c'
|
|
83
|
-
);
|
|
84
|
-
t.deepEqual(r.ast.inParams, ['"hello-world"']);
|
|
85
|
-
t.deepEqual(r.ast.tasks, [
|
|
86
|
-
{ f: falpha, a: ['"another-string"'], out: ['c'], type: 'cb', name: 'falpha'}
|
|
87
|
-
]);
|
|
88
|
-
t.deepEqual(r.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
89
|
-
t.end();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
test('single task, ERR and out params', function (t) {
|
|
93
|
-
var r = react('myName', 'cb -> ERR, c',
|
|
94
|
-
falpha, 'cb -> ERR, c'
|
|
95
|
-
);
|
|
96
|
-
t.deepEqual(r.ast.inParams, []);
|
|
97
|
-
t.deepEqual(r.ast.tasks, [
|
|
98
|
-
{ f: falpha, a: [], out: ['c'], type: 'cb', name: 'falpha'}
|
|
99
|
-
]);
|
|
100
|
-
t.deepEqual(r.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
101
|
-
t.end();
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('cb used in defs is simply ignored', function (t) {
|
|
105
|
-
var r = react('myName', 'a, b, cb -> err, c',
|
|
106
|
-
falpha, 'a, b, cb -> err, c'
|
|
107
|
-
);
|
|
108
|
-
t.deepEqual(r.ast.inParams, ['a', 'b']);
|
|
109
|
-
t.deepEqual(r.ast.tasks, [
|
|
110
|
-
{ f: falpha, a: ['a', 'b'], out: ['c'], type: 'cb', name: 'falpha'}
|
|
111
|
-
]);
|
|
112
|
-
t.deepEqual(r.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
113
|
-
t.end();
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
test('callback used in defs is simply ignored', function (t) {
|
|
117
|
-
var r = react('myName', 'a, b, callback -> err, c',
|
|
118
|
-
falpha, 'a, b, callback -> err, c'
|
|
119
|
-
);
|
|
120
|
-
t.deepEqual(r.ast.inParams, ['a', 'b']);
|
|
121
|
-
t.deepEqual(r.ast.tasks, [
|
|
122
|
-
{ f: falpha, a: ['a', 'b'], out: ['c'], type: 'cb', name: 'falpha'}
|
|
123
|
-
]);
|
|
124
|
-
t.deepEqual(r.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
125
|
-
t.end();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
test('two inputs, two tasks, two out params', function (t) {
|
|
129
|
-
var r = react('myName', 'a, b, cb -> err, c, d',
|
|
130
|
-
falpha, 'a, b, cb -> err, c',
|
|
131
|
-
fbeta, 'a, b, cb -> err, d, e'
|
|
132
|
-
);
|
|
133
|
-
t.deepEqual(r.ast.inParams, ['a', 'b']);
|
|
134
|
-
t.deepEqual(r.ast.tasks, [
|
|
135
|
-
{ f: falpha, a: ['a', 'b'], out: ['c'], type: 'cb', name: 'falpha'},
|
|
136
|
-
{ f: fbeta, a: ['a', 'b'], out: ['d', 'e'], type: 'cb', name: 'fbeta'}
|
|
137
|
-
]);
|
|
138
|
-
t.deepEqual(r.ast.outTask, { a: ['c', 'd'], type: 'finalcb' });
|
|
139
|
-
t.end();
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test('two inputs, two tasks, two out params, options', function (t) {
|
|
143
|
-
var r = react('myName', 'a, b, cb -> err, c, d',
|
|
144
|
-
{ otherOptFoo: 'foo'}, // main flow options
|
|
145
|
-
falpha, 'a, b, cb -> err, c',
|
|
146
|
-
fbeta, 'a, b, cb -> err, d, e'
|
|
147
|
-
);
|
|
148
|
-
t.deepEqual(r.ast.inParams, ['a', 'b']);
|
|
149
|
-
t.deepEqual(r.ast.tasks, [
|
|
150
|
-
{ f: falpha, a: ['a', 'b'], out: ['c'], type: 'cb', name: 'falpha'},
|
|
151
|
-
{ f: fbeta, a: ['a', 'b'], out: ['d', 'e'], type: 'cb', name: 'fbeta'}
|
|
152
|
-
]);
|
|
153
|
-
t.deepEqual(r.ast.outTask, { a: ['c', 'd'], type: 'finalcb' });
|
|
154
|
-
t.equal(r.ast.name, 'myName', 'name should match');
|
|
155
|
-
t.equal(r.ast.otherOptFoo, 'foo', 'other options should pass through');
|
|
156
|
-
t.end();
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test('two inputs, two mixed tasks, two out params', function (t) {
|
|
160
|
-
var r = react('myName', 'a, b, cb -> err, c, d',
|
|
161
|
-
falpha, 'a, b, cb -> err, c',
|
|
162
|
-
fbeta, 'a, b -> d'
|
|
163
|
-
);
|
|
164
|
-
t.deepEqual(r.ast.inParams, ['a', 'b']);
|
|
165
|
-
t.deepEqual(r.ast.tasks, [
|
|
166
|
-
{ f: falpha, a: ['a', 'b'], out: ['c'], type: 'cb', name: 'falpha'},
|
|
167
|
-
{ f: fbeta, a: ['a', 'b'], out: ['d'], type: 'ret', name: 'fbeta'}
|
|
168
|
-
]);
|
|
169
|
-
t.deepEqual(r.ast.outTask, { a: ['c', 'd'], type: 'finalcb' });
|
|
170
|
-
t.end();
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
test('two inputs, two mixed tasks, two out params, opts', function (t) {
|
|
175
|
-
var r = react('myName', 'a, b, cb -> err, c, d',
|
|
176
|
-
falpha, 'a, cb -> err, c', { after: fbeta },
|
|
177
|
-
fbeta, 'a, b -> d'
|
|
178
|
-
);
|
|
179
|
-
t.deepEqual(r.ast.inParams, ['a', 'b']);
|
|
180
|
-
t.deepEqual(r.ast.tasks, [
|
|
181
|
-
{ after: ['fbeta'], f: falpha, a: ['a'], out: ['c'], type: 'cb', name: 'falpha'},
|
|
182
|
-
{ f: fbeta, a: ['a', 'b'], out: ['d'], type: 'ret', name: 'fbeta'}
|
|
183
|
-
]);
|
|
184
|
-
t.deepEqual(r.ast.outTask, { a: ['c', 'd'], type: 'finalcb' });
|
|
185
|
-
t.end();
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
// Object use
|
|
190
|
-
test('object prop task params', function (t) {
|
|
191
|
-
var r = react('myName', 'a, b, cb -> err, c, e',
|
|
192
|
-
falpha, 'a, b.cat, cb -> err, c',
|
|
193
|
-
fbeta, 'c.dog, b -> d',
|
|
194
|
-
'd.egg', 'c, cb -> err, e'
|
|
195
|
-
);
|
|
196
|
-
t.deepEqual(r.ast.inParams, ['a', 'b']);
|
|
197
|
-
t.deepEqual(r.ast.tasks, [
|
|
198
|
-
{ f: falpha, a: ['a', 'b.cat'], out: ['c'], type: 'cb', name: 'falpha'},
|
|
199
|
-
{ f: fbeta, a: ['c.dog', 'b'], out: ['d'], type: 'ret', name: 'fbeta'},
|
|
200
|
-
{ f: 'd.egg', a: ['c'], out: ['e'], type: 'cb', name: 'd.egg'}
|
|
201
|
-
]);
|
|
202
|
-
t.deepEqual(r.ast.outTask, { a: ['c', 'e'], type: 'finalcb' });
|
|
203
|
-
t.end();
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
// Errors
|
|
207
|
-
|
|
208
|
-
test('missing name, throws error', function (t) {
|
|
209
|
-
var fn = function () {
|
|
210
|
-
var r = react('cb -> err, c',
|
|
211
|
-
falpha, 'cb -> err, c'
|
|
212
|
-
);
|
|
213
|
-
};
|
|
214
|
-
t.throws(fn, new Error('first flow parameter should be the flow name, but found in/out def: cb -> err, c'));
|
|
215
|
-
t.end();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
test('missing err in flow in/out - force for consistency, throw error', function (t) {
|
|
219
|
-
var fn = function () {
|
|
220
|
-
var r = react('myname', 'cb -> c', // missing err
|
|
221
|
-
falpha, 'cb -> err, c'
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
t.throws(fn, new Error('callback specified, but first out param was not "err", use for clarity. Found in/out def: cb -> c'));
|
|
225
|
-
t.end();
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
test('missing err in task in/out - force for consistency, throw error', function (t) {
|
|
229
|
-
var fn = function () {
|
|
230
|
-
var r = react('myname', 'cb -> err, c',
|
|
231
|
-
falpha, 'cb -> c' // missing err
|
|
232
|
-
);
|
|
233
|
-
};
|
|
234
|
-
t.throws(fn, new Error('callback specified, but first out param was not "err", use for clarity. Found in/out def: cb -> c'));
|
|
235
|
-
t.end();
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
test('found err, but missing cb/callback in flow in/out - force for consistency, throw error', function (t) {
|
|
239
|
-
var fn = function () {
|
|
240
|
-
var r = react('myname', 'a -> err, c', // missing cb
|
|
241
|
-
falpha, 'cb -> err, c'
|
|
242
|
-
);
|
|
243
|
-
};
|
|
244
|
-
t.throws(fn, new Error('found err param, but cb/callback is not specified, is this cb-style async or sync function? Found in/out def: a -> err, c'));
|
|
245
|
-
t.end();
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
test('found err, but missing cb/callback in task in/out - force for consistency, throw error', function (t) {
|
|
249
|
-
var fn = function () {
|
|
250
|
-
var r = react('myname', 'cb -> err, c',
|
|
251
|
-
falpha, 'a -> err, c' // missing cb
|
|
252
|
-
);
|
|
253
|
-
};
|
|
254
|
-
t.throws(fn, new Error('found err param, but cb/callback is not specified, is this cb-style async or sync function? Found in/out def: a -> err, c'));
|
|
255
|
-
t.end();
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
test('extra arg throws error', function (t) {
|
|
259
|
-
var fn = function () {
|
|
260
|
-
var r = react('myName', 'a, b, cb -> err, c, d',
|
|
261
|
-
falpha, 'a, cb -> err, c', { after: fbeta },
|
|
262
|
-
fbeta, 'a, b -> returns d',
|
|
263
|
-
'extraBadArg'
|
|
264
|
-
);
|
|
265
|
-
};
|
|
266
|
-
t.throws(fn, new Error('extra unmatched task arg: extraBadArg'));
|
|
267
|
-
t.end();
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
test('not enough args throws error', function (t) {
|
|
271
|
-
var fn = function () {
|
|
272
|
-
var r = react('myName', 'a, b, cb -> err, c, d',
|
|
273
|
-
falpha, 'a, cb -> err, c', { after: fbeta },
|
|
274
|
-
fbeta
|
|
275
|
-
);
|
|
276
|
-
};
|
|
277
|
-
t.throws(fn, new Error(sprintf('extra unmatched task arg: %s', fbeta)));
|
|
278
|
-
t.end();
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
test('long example', function (t) {
|
|
282
|
-
/*jshint white: false */
|
|
283
|
-
t.plan(4);
|
|
284
|
-
function loadUser(uid, cb){ setTimeout(cb, 100, null, "User"+uid); }
|
|
285
|
-
function loadFile(filename, cb){ setTimeout(cb, 100, null, 'Filedata'+filename); }
|
|
286
|
-
function markdown(filedata) { return 'html'+filedata; }
|
|
287
|
-
function prepareDirectory(outDirname, cb){ setTimeout(cb, 200, null, 'dircreated-'+outDirname); }
|
|
288
|
-
function writeOutput(html, user, cb){ setTimeout(cb, 300, null, html+'_bytesWritten'); }
|
|
289
|
-
function loadEmailTemplate(cb) { setTimeout(cb, 50, null, 'emailmd'); }
|
|
290
|
-
function customizeEmail(user, emailHtml) { return 'cust-'+user+emailHtml; }
|
|
291
|
-
function deliverEmail(custEmailHtml, cb) { setTimeout(cb, 100, null, 'delivered-'+custEmailHtml); }
|
|
292
|
-
var loadAndSave = react('loadAndSave', 'filename, uid, outDirname, cb -> err, html, user, bytesWritten', // name, in/out params
|
|
293
|
-
loadUser, 'uid, cb -> err, user', // calling async fn loadUser with uid, callback is called with err and user
|
|
294
|
-
loadFile, 'filename, cb -> err, filedata',
|
|
295
|
-
markdown, 'filedata -> html', // using a sync function
|
|
296
|
-
prepareDirectory, 'outDirname, cb -> err, dircreated',
|
|
297
|
-
writeOutput, 'html, user, cb -> err, bytesWritten', { after: prepareDirectory }, // only after prepareDirectory done
|
|
298
|
-
loadEmailTemplate, 'cb -> err, emailmd',
|
|
299
|
-
markdown, 'emailmd -> emailHtml', // using a sync function
|
|
300
|
-
customizeEmail, 'user, emailHtml -> custEmailHtml',
|
|
301
|
-
deliverEmail, 'custEmailHtml, cb -> err, deliveredEmail', { after: writeOutput } // only after writeOutput is done
|
|
302
|
-
);
|
|
303
|
-
loadAndSave('file.md', 100, '/tmp/foo', function (err, html, user, bytesWritten) { // executing the flow
|
|
304
|
-
t.equal(err, null);
|
|
305
|
-
t.equal(html, 'htmlFiledatafile.md');
|
|
306
|
-
t.equal(user, 'User100');
|
|
307
|
-
t.equal(bytesWritten, 'htmlFiledatafile.md_bytesWritten');
|
|
308
|
-
t.end();
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
// selectFirst
|
|
313
|
-
|
|
314
|
-
test('selectFirst', function (t) {
|
|
315
|
-
var r = react.selectFirst('myName', 'a, b, cb -> err, c',
|
|
316
|
-
{ otherOptFoo: 'foo'}, // main options
|
|
317
|
-
falpha, 'a, b, cb -> err, c',
|
|
318
|
-
fbeta, 'a, b -> c'
|
|
319
|
-
);
|
|
320
|
-
t.equal(r.ast.name, 'myName');
|
|
321
|
-
t.deepEqual(r.ast.inParams, ['a', 'b']);
|
|
322
|
-
t.deepEqual(r.ast.tasks, [
|
|
323
|
-
{ f: falpha, a: ['a', 'b'], out: ['c'], type: 'cb', name: 'falpha'},
|
|
324
|
-
{ f: fbeta, a: ['a', 'b'], out: ['c'], type: 'ret', name: 'fbeta', after: ['falpha']}
|
|
325
|
-
]);
|
|
326
|
-
t.deepEqual(r.ast.outTask, { type: 'finalcbFirst', a: ['c'] });
|
|
327
|
-
t.equal(r.ast.name, 'myName', 'name should match if supplied');
|
|
328
|
-
t.equal(r.ast.otherOptFoo, 'foo', 'other options should pass through');
|
|
329
|
-
t.end();
|
|
330
|
-
});
|
package/test/dsl/chain.test.js
DELETED
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tap').test;
|
|
4
|
-
var sprintf = require('sprintf').sprintf;
|
|
5
|
-
|
|
6
|
-
var chainDefine = require('../../dsl/chain'); // require('react/dsl/chain');
|
|
7
|
-
require('../../lib/track-tasks'); // require('react/lib/track-tasks'); // turn on tracking
|
|
8
|
-
|
|
9
|
-
function falpha() { }
|
|
10
|
-
function fbeta() { }
|
|
11
|
-
|
|
12
|
-
test('module exports a function', function (t) {
|
|
13
|
-
t.type(chainDefine, 'function', 'has define by chain method');
|
|
14
|
-
t.type(chainDefine(), 'object', 'has define by chain method');
|
|
15
|
-
t.type(chainDefine().selectFirst, 'function', 'has selectFirst def');
|
|
16
|
-
t.type(chainDefine().in, 'function', 'has input param def');
|
|
17
|
-
t.type(chainDefine().out, 'function', 'has output param def');
|
|
18
|
-
t.type(chainDefine().async, 'function', 'has async - cb type task def');
|
|
19
|
-
t.type(chainDefine().sync, 'function', 'has sync - ret type task def');
|
|
20
|
-
t.type(chainDefine().after, 'function', 'has after prereq def');
|
|
21
|
-
t.type(chainDefine().end, 'function', 'has end to complete flow and validate');
|
|
22
|
-
t.end();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('no arguments -> empty inParams, tasks, outTask', function (t) {
|
|
26
|
-
var fn = chainDefine().end();
|
|
27
|
-
t.deepEqual(fn.ast.inParams, []);
|
|
28
|
-
t.deepEqual(fn.ast.tasks, []);
|
|
29
|
-
t.deepEqual(fn.ast.outTask, { a: [], type: 'finalcb' });
|
|
30
|
-
t.end();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
test('in only -> inParams["foo"], empty tasks, outTask', function (t) {
|
|
35
|
-
var fn = chainDefine()
|
|
36
|
-
.in('foo')
|
|
37
|
-
.end();
|
|
38
|
-
t.deepEqual(fn.ast.inParams, ['foo']);
|
|
39
|
-
t.deepEqual(fn.ast.tasks, []);
|
|
40
|
-
t.deepEqual(fn.ast.outTask, { a: [], type: 'finalcb' });
|
|
41
|
-
t.end();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('in empty -> inParams["foo"], empty tasks, outTask', function (t) {
|
|
45
|
-
var fn = chainDefine()
|
|
46
|
-
.in()
|
|
47
|
-
.end();
|
|
48
|
-
t.deepEqual(fn.ast.inParams, []);
|
|
49
|
-
t.deepEqual(fn.ast.tasks, []);
|
|
50
|
-
t.deepEqual(fn.ast.outTask, { a: [], type: 'finalcb' });
|
|
51
|
-
t.end();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
test('in triple first param -> inParams["foo", "bar", "baz"]', function (t) {
|
|
56
|
-
var fn = chainDefine()
|
|
57
|
-
.in('foo', 'bar', 'baz')
|
|
58
|
-
.end();
|
|
59
|
-
t.deepEqual(fn.ast.inParams, ['foo', 'bar', 'baz']);
|
|
60
|
-
t.deepEqual(fn.ast.tasks, []);
|
|
61
|
-
t.deepEqual(fn.ast.outTask, { a: [], type: 'finalcb' });
|
|
62
|
-
t.end();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('single task, single out params', function (t) {
|
|
66
|
-
var fn = chainDefine()
|
|
67
|
-
.in('a', 'b')
|
|
68
|
-
.out('c')
|
|
69
|
-
.async(falpha).in('a', 'b').out('c')
|
|
70
|
-
.end();
|
|
71
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
72
|
-
t.deepEqual(fn.ast.tasks, [
|
|
73
|
-
{ f: falpha, type: 'cb', a: ['a', 'b'], out: ['c'], name: 'falpha' }
|
|
74
|
-
]);
|
|
75
|
-
t.deepEqual(fn.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
76
|
-
t.end();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('single task, err params', function (t) {
|
|
80
|
-
var fn = chainDefine()
|
|
81
|
-
.out('err')
|
|
82
|
-
.async(falpha).in().out('err', 'c')
|
|
83
|
-
.end();
|
|
84
|
-
t.deepEqual(fn.ast.inParams, []);
|
|
85
|
-
t.deepEqual(fn.ast.tasks, [
|
|
86
|
-
{ f: falpha, type: 'cb', a: [], out: ['c'], name: 'falpha' }
|
|
87
|
-
]);
|
|
88
|
-
t.deepEqual(fn.ast.outTask, { a: [], type: 'finalcb' });
|
|
89
|
-
t.end();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
test('single task, err and out params', function (t) {
|
|
93
|
-
var fn = chainDefine()
|
|
94
|
-
.out('err', 'c')
|
|
95
|
-
.async(falpha).in().out('err', 'c')
|
|
96
|
-
.end();
|
|
97
|
-
t.deepEqual(fn.ast.inParams, []);
|
|
98
|
-
t.deepEqual(fn.ast.tasks, [
|
|
99
|
-
{ f: falpha, type: 'cb', a: [], out: ['c'], name: 'falpha' }
|
|
100
|
-
]);
|
|
101
|
-
t.deepEqual(fn.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
102
|
-
t.end();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
test('single task, ERR and out params', function (t) {
|
|
106
|
-
var fn = chainDefine()
|
|
107
|
-
.out('ERR', 'c')
|
|
108
|
-
.async(falpha).in().out('ERR', 'c')
|
|
109
|
-
.end();
|
|
110
|
-
t.deepEqual(fn.ast.inParams, []);
|
|
111
|
-
t.deepEqual(fn.ast.tasks, [
|
|
112
|
-
{ f: falpha, type: 'cb', a: [], out: ['c'], name: 'falpha' }
|
|
113
|
-
]);
|
|
114
|
-
t.deepEqual(fn.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
115
|
-
t.end();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test('cb used in defs is simply ignored', function (t) {
|
|
119
|
-
var fn = chainDefine()
|
|
120
|
-
.in('a', 'b', 'cb')
|
|
121
|
-
.out('err', 'c')
|
|
122
|
-
.async(falpha).in('a', 'b', 'cb').out('err', 'c')
|
|
123
|
-
.end();
|
|
124
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
125
|
-
t.deepEqual(fn.ast.tasks, [
|
|
126
|
-
{ f: falpha, type: 'cb', a: ['a', 'b'], out: ['c'], name: 'falpha'}
|
|
127
|
-
]);
|
|
128
|
-
t.deepEqual(fn.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
129
|
-
t.end();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
test('callback used in defs is simply ignored', function (t) {
|
|
133
|
-
var fn = chainDefine()
|
|
134
|
-
.in('a', 'b', 'callback')
|
|
135
|
-
.out('err', 'c')
|
|
136
|
-
.async(falpha).in('a', 'b', 'callback').out('err', 'c')
|
|
137
|
-
.end();
|
|
138
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
139
|
-
t.deepEqual(fn.ast.tasks, [
|
|
140
|
-
{ f: falpha, type: 'cb', a: ['a', 'b'], out: ['c'], name: 'falpha'}
|
|
141
|
-
]);
|
|
142
|
-
t.deepEqual(fn.ast.outTask, { a: ['c'], type: 'finalcb' });
|
|
143
|
-
t.end();
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
test('two inputs, two tasks, two out params', function (t) {
|
|
147
|
-
var fn = chainDefine()
|
|
148
|
-
.in('a', 'b', 'cb')
|
|
149
|
-
.out('err', 'c', 'd')
|
|
150
|
-
.async(falpha).in('a', 'b', 'cb').out('err', 'c')
|
|
151
|
-
.async(fbeta).in('a', 'b', 'cb').out('err', 'd', 'e')
|
|
152
|
-
.end();
|
|
153
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
154
|
-
t.deepEqual(fn.ast.tasks, [
|
|
155
|
-
{ f: falpha, type: 'cb', a: ['a', 'b'], out: ['c'], name: 'falpha'},
|
|
156
|
-
{ f: fbeta, type: 'cb', a: ['a', 'b'], out: ['d', 'e'], name: 'fbeta'}
|
|
157
|
-
]);
|
|
158
|
-
t.deepEqual(fn.ast.outTask, { a: ['c', 'd'], type: 'finalcb' });
|
|
159
|
-
t.end();
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test('two inputs, two tasks, two out params, name, options', function (t) {
|
|
163
|
-
var fn = chainDefine()
|
|
164
|
-
.name('myflow')
|
|
165
|
-
.in('a', 'b', 'cb')
|
|
166
|
-
.out('err', 'c', 'd')
|
|
167
|
-
.options({ otherOptFoo: 'foo'})
|
|
168
|
-
.async(falpha).in('a', 'b', 'cb').out('err', 'c').name('myalpha')
|
|
169
|
-
.async(fbeta).in('a', 'b', 'cb').out('err', 'd', 'e').options({ bar: 'bar'})
|
|
170
|
-
.end();
|
|
171
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
172
|
-
t.deepEqual(fn.ast.tasks, [
|
|
173
|
-
{ f: falpha, type: 'cb', a: ['a', 'b'], out: ['c'], name: 'myalpha'},
|
|
174
|
-
{ f: fbeta, type: 'cb', a: ['a', 'b'], out: ['d', 'e'],
|
|
175
|
-
bar: 'bar', name: 'fbeta' }
|
|
176
|
-
]);
|
|
177
|
-
t.deepEqual(fn.ast.outTask, { a: ['c', 'd'], type: 'finalcb' });
|
|
178
|
-
t.equal(fn.ast.name, 'myflow', 'name should match if supplied');
|
|
179
|
-
t.equal(fn.ast.otherOptFoo, 'foo', 'other options should pass through');
|
|
180
|
-
t.end();
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test('two inputs, two mixed tasks, two out params', function (t) {
|
|
184
|
-
var fn = chainDefine()
|
|
185
|
-
.in('a', 'b', 'cb')
|
|
186
|
-
.out('err', 'c', 'd')
|
|
187
|
-
.async(falpha).in('a', 'b', 'cb').out('err', 'c')
|
|
188
|
-
.sync(fbeta).in('a', 'b').out('d')
|
|
189
|
-
.end();
|
|
190
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
191
|
-
t.deepEqual(fn.ast.tasks, [
|
|
192
|
-
{ f: falpha, type: 'cb', a: ['a', 'b'], out: ['c'], name: 'falpha'},
|
|
193
|
-
{ f: fbeta, type: 'ret', a: ['a', 'b'], out: ['d'], name: 'fbeta'}
|
|
194
|
-
]);
|
|
195
|
-
t.deepEqual(fn.ast.outTask, { a: ['c', 'd'], type: 'finalcb' });
|
|
196
|
-
t.end();
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
test('two inputs, two mixed tasks, two out params, opts', function (t) {
|
|
200
|
-
var fn = chainDefine()
|
|
201
|
-
.in('a', 'b', 'cb')
|
|
202
|
-
.out('err', 'c', 'd')
|
|
203
|
-
.async(falpha).in('a', 'b', 'cb').out('err', 'c').after(fbeta)
|
|
204
|
-
.sync(fbeta).in('a', 'b').out('d')
|
|
205
|
-
.end();
|
|
206
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
207
|
-
t.deepEqual(fn.ast.tasks, [
|
|
208
|
-
{ f: falpha, type: 'cb', a: ['a', 'b'], out: ['c'], after: ['fbeta'], name: 'falpha'},
|
|
209
|
-
{ f: fbeta, type: 'ret', a: ['a', 'b'], out: ['d'], name: 'fbeta'}
|
|
210
|
-
]);
|
|
211
|
-
t.deepEqual(fn.ast.outTask, { a: ['c', 'd'], type: 'finalcb' });
|
|
212
|
-
t.end();
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
// Object use
|
|
216
|
-
test('object prop task params', function (t) {
|
|
217
|
-
var fn = chainDefine()
|
|
218
|
-
.in('a', 'b', 'cb')
|
|
219
|
-
.out('err', 'c', 'e')
|
|
220
|
-
.async(falpha).in('a', 'b.cat', 'cb').out('err', 'c')
|
|
221
|
-
.sync(fbeta).in('c.dog', 'b').out('d')
|
|
222
|
-
.async('d.egg').in('c').out('err', 'e')
|
|
223
|
-
.end();
|
|
224
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
225
|
-
t.deepEqual(fn.ast.tasks, [
|
|
226
|
-
{ f: falpha, type: 'cb', a: ['a', 'b.cat'], out: ['c'], name: 'falpha'},
|
|
227
|
-
{ f: fbeta, type: 'ret', a: ['c.dog', 'b'], out: ['d'], name: 'fbeta'},
|
|
228
|
-
{ f: 'd.egg', type: 'cb', a: ['c'], out: ['e'], name: 'd.egg'}
|
|
229
|
-
]);
|
|
230
|
-
t.deepEqual(fn.ast.outTask, { a: ['c', 'e'], type: 'finalcb' });
|
|
231
|
-
t.end();
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
// selectFirst
|
|
236
|
-
|
|
237
|
-
test('selectFirst', function (t) {
|
|
238
|
-
var fn = chainDefine()
|
|
239
|
-
.selectFirst()
|
|
240
|
-
.in('a', 'b', 'cb')
|
|
241
|
-
.out('err', 'c')
|
|
242
|
-
.async(falpha).in('a', 'b', 'cb').out('err', 'c')
|
|
243
|
-
.sync(fbeta).in('a', 'b').out('c')
|
|
244
|
-
.end();
|
|
245
|
-
t.deepEqual(fn.ast.inParams, ['a', 'b']);
|
|
246
|
-
t.deepEqual(fn.ast.tasks, [
|
|
247
|
-
{ f: falpha, type: 'cb', a: ['a', 'b'], out: ['c'], name: 'falpha'},
|
|
248
|
-
{ f: fbeta, type: 'ret', a: ['a', 'b'], out: ['c'], name: 'fbeta', after: ['falpha']}
|
|
249
|
-
]);
|
|
250
|
-
t.deepEqual(fn.ast.outTask, { a: ['c'], type: 'finalcbFirst' });
|
|
251
|
-
t.end();
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
// full integration tests
|
|
256
|
-
|
|
257
|
-
test('chainDefine use', function (t) {
|
|
258
|
-
t.plan(8);
|
|
259
|
-
function multiply(a, b, cb) { cb(null, a * b); }
|
|
260
|
-
function add(a, b, cb) { cb(null, a + b); }
|
|
261
|
-
|
|
262
|
-
var events = [];
|
|
263
|
-
function accumEvents(task) {
|
|
264
|
-
events.push(task);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
var fn = chainDefine()
|
|
268
|
-
.in('a', 'b', 'cb')
|
|
269
|
-
.out('err', 'm', 's')
|
|
270
|
-
.async(multiply).in('a', 'b', 'cb').out('err', 'm')
|
|
271
|
-
.async(add).in('m', 'a', 'cb').out('err', 's')
|
|
272
|
-
.end();
|
|
273
|
-
|
|
274
|
-
fn.events.on('task.complete', accumEvents);
|
|
275
|
-
|
|
276
|
-
fn(2, 3, function (err, m, s) {
|
|
277
|
-
t.deepEqual(err, null, 'should not be any error');
|
|
278
|
-
t.equal(m, 6);
|
|
279
|
-
t.equal(s, 8);
|
|
280
|
-
t.equal(events.length, 2, 'should have seen two task compl events');
|
|
281
|
-
t.equal(events[0].name, 'multiply', 'name matches');
|
|
282
|
-
t.deepEqual(events[0].results, [6], 'results match');
|
|
283
|
-
t.equal(events[1].name, 'add', 'name matches');
|
|
284
|
-
t.deepEqual(events[1].results, [8], 'results match');
|
|
285
|
-
t.end();
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
test('use chainDefine selectFirst with events', function (t) {
|
|
290
|
-
t.plan(7);
|
|
291
|
-
function noSuccess(a, b, cb) {
|
|
292
|
-
setTimeout(function () { cb(null); }, 100); // returns undefined result
|
|
293
|
-
}
|
|
294
|
-
function noSuccessNull(a, b, cb) { cb(null, null); } // returns null result
|
|
295
|
-
function add(a, b, cb) { cb(null, a + b); }
|
|
296
|
-
|
|
297
|
-
var events = [];
|
|
298
|
-
function accumEvents(task) {
|
|
299
|
-
events.push(task);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
var fn = chainDefine()
|
|
303
|
-
.selectFirst()
|
|
304
|
-
.in('a', 'b', 'cb')
|
|
305
|
-
.out('err', 'c')
|
|
306
|
-
.async(noSuccess).in('a', 'b', 'cb').out('err', 'c')
|
|
307
|
-
.async(noSuccessNull).in('a', 'b', 'cb').out('err', 'c')
|
|
308
|
-
.async(add).in('a', 'b', 'cb').out('err', 'c')
|
|
309
|
-
.async(noSuccess).in('a', 'b', 'cb').out('err', 'c')
|
|
310
|
-
.end();
|
|
311
|
-
|
|
312
|
-
fn.events.on('task.complete', accumEvents);
|
|
313
|
-
|
|
314
|
-
fn(2, 3, function (err, c) {
|
|
315
|
-
t.deepEqual(err, null, 'should not be any error');
|
|
316
|
-
t.equal(c, 5);
|
|
317
|
-
t.equal(events.length, 3, 'should have seen two task compl events');
|
|
318
|
-
t.equal(events[0].name, 'noSuccess', 'name matches');
|
|
319
|
-
t.equal(events[1].name, 'noSuccessNull', 'name matches');
|
|
320
|
-
t.equal(events[2].name, 'add', 'name matches');
|
|
321
|
-
t.deepEqual(events[2].results, [5], 'results match');
|
|
322
|
-
t.end();
|
|
323
|
-
});
|
|
324
|
-
});
|