This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("When getting orders report, get the existing orders", () => { | |
//This one hopefully is telling a direct and explicit story | |
const orderWeJustAdded = ordersTestHelpers.addRandomNewOrder(); | |
const queryObject = newQueryObject(config.DBInstanceURL, queryOptions.deep, useCache:false); | |
const result = queryObject.query(config.adminUserToken, reports.orders, pageSize:200); | |
expect(result).to.be.an('array').that.does.include(orderWeJustAdded); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function take2() { | |
// Running Promises in parallel | |
const listOfPromises = listOfArguments.map(asyncOperation); | |
// Harvesting | |
return await Promise.all(listOfPromises); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function take3subtake1part0() { | |
const concurrencyLimit = 5; | |
const argsCopy = listOfArguments.slice(); | |
const promises = new Array(concurrencyLimit).fill(Promise.resolve()); | |
// Recursively chain the next Promise to the currently executed Promise | |
function chainNext(p) { | |
if (argsCopy.length) { | |
const arg = argsCopy.shift(); | |
return p.then(() => { | |
const operationPromise = asyncOperation(arg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = require('config'); | |
const jwt = require('jsonwebtoken'); | |
const Joi = require('joi'); | |
const mongoose = require('mongoose'); | |
//simple schema | |
const UserSchema = new mongoose.Schema({ | |
name: { | |
type: String, | |
required: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converts the time string into Date Object | |
const timestamp = _time => Date.parse(_time) / 1000; | |
/** | |
* 1. group-by given keys | |
* 2. sort the groups in ascending order for Time key | |
* 3. filters duplicate entries with time difference < 60 seconds | |
* | |
* @param _array Array [required] | |
* @param _function Function [required] |
OlderNewer