diff --git a/test/test-later.js b/test/test-later.js new file mode 100644 index 0000000..26ccb77 --- /dev/null +++ b/test/test-later.js @@ -0,0 +1,17 @@ +port(DIR.IP('http://localhost:10001')) +// collector task +later(1000, function () { + var tuples = inp(['SURVEY',_],true)||[]; + log('Got '+tuples.length+' surveys'); + if (tuples.length) { + csv.write('surveys.csv',_,pluck(tuples,1)); + } + return true; +}); + +// test only +later(2000, function () { + out(['SURVEY',{from:'test',answer:'yes'}]); + out(['SURVEY',{from:'test',answer:'no'}]); +}) +start()