From a367c55854b301e34cb3c7c3149c873a4995c82b Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:16:16 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-later.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/test-later.js 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()