Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | process.env.LEO_DEFAULT_PROFILE = "leo"; var leo = require("../index.js"); var api = require("../lib/template/api-request.js"); var moment = require("moment"); const logger = require("../lib/logger"); logger.configure("all", { log: true }) describe("local", function () { it("Should be retrieve a nicely formatted workflow", function (done) { this.timeout(60000); let ID = "api-request-bot"; let inQueue = "Q1"; let outQueue = "api-request-out"; leo.streams.pipe( leo.read(ID, inQueue), leo.streams.process(ID, (payload, event, done) => { done(null, { q: `select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="nome, ak")` }); }, outQueue), api({ url: "https://query.yahooapis.com/v1/public/yql", request: { method: "GET" }, batch: 10, api: function (url, data, opts) { // This is only need to append data to the url for a GET query // this field is not needed for a POST return this.api(`${url}?q=${encodeURIComponent(data.q)}&format=json`, null, opts); }, retries: 3, // Default is 3 offset: function (retryCount) { return { seconds: Math.pow(2, retryCount) } } // Default is 2^retryCount seconds }), leo.write(ID), leo.checkpoint(), (err) => { console.log("finished", err || ""); done(err); } ) }); }); |