/* * Helper to load in all app plugins */ const loadPlugins = (app, lando) => Promise.resolve(app.plugins.registry) // Filter out .filter(plugin => _.has(plugin, 'app')) // LOADEM! .map(plugin => app.plugins.load(plugin, plugin.app, app, lando)) // Remove any naughty shit .map(plugin => _.pick(plugin.data, ['config', 'composeData', 'env', 'labels'])) // Merge minotaur .each(result => _.merge(app, result))
// Helper to retry each const retryEach = (data, run) => Promise.each(utils.normalizer(data), datum => run(datum))
describe('WebHook', function webHookSuite() { it('returns 200 OK for health endpoint', function test(done) { utils.sendWebHookRequest(webHookPort2, '/healthz').then(resp => { assert.equal(resp, 'OK'); return done(); }); }); it('returns 401 error if token is wrong', function test(done) { utils.sendWebHookMessage(webHookPort2, 'wrong-token').catch(resp => { assert.equal(resp.statusCode, 401); return done(); }); }); it('only accepts POST method', function test() { const methods = ['GET', 'PUT', 'DELETE', 'OPTIONS']; return Promise.each(methods, (method) => { return utils.sendWebHookMessage(webHookPort2, TOKEN, { method, }).then(() => { throw new Error(`expected error with webhook ${method} request`); }).catch(resp => { if (!resp.statusCode) throw resp; if (resp.statusCode !== 418) throw new Error(`unexpected error: ${resp.body}`); }); }); // Promise.each }); });
Promise.resolve(_.keys(docs.sections)) .each(section => { return jsdoc2md.getTemplateData({'files': docs.sections[section], 'no-cache': true})
return Promise.each(fns, fn => {
return this.Promise.each(bootstraps, level => { this.log.verbose('%s bootstrap beginning...', level); this._bootstrap = level;
ui.listr.callsFake((tasks, ctx) => Promise.each(tasks, (task) => { if (task.skip && task.skip(ctx) || (task.enabled && !task.enabled(ctx))) { return; } return task.task(ctx); }));
const getCountOfServicesAndDoctors = async (hospital) => { const services = new Set(); await Promise.each(hospital.doctors, async (id) => { const doctor = await doctorsDal.getDoctorById(id); for(const service of doctor.services){ services.add(service); } }); hospital.services = services.size; hospital.doctors = hospital.doctors.length; return hospital; }
function fakeListr(tasks, ctx) { expect(ctx).to.be.false; return Promise.each(tasks, (task) => { if (task.skip && task.skip()) { return; } return task.task(); }); }
async stopAll() { const Promise = require('bluebird'); const instances = this.system.getAllInstances(true); await Promise.each(instances, async ({name}) => { await this.ui.run(() => this.run({quiet: true, name}), `Stopping Ghost: ${name}`); }); }
Promise.each(hooks, function (hook) { //if (_.isPlainObject(hook)) { //hook = hook.fn; //} return hook.apply(self, fnArgs); }).return()
Promise.each( knownPeers .filter(knownPeer => knownPeer.id !== global.id) .map(knowPeer => request.send(knownPeer, { operation: 'transaction', fromId, toId, amount })), () => { })
ui.listr.callsFake((tasks, ctx) => Promise.each(tasks, (task) => { if (task.skip && task.skip(ctx) || (task.enabled && !task.enabled(ctx))) { return; } return task.task(ctx); }));
ui.listr.callsFake((tasks, ctx) => Promise.each(tasks, (task) => { if ((task.skip && task.skip(ctx)) || (task.enabled && !task.enabled(ctx))) { return; } return task.task(ctx); }));