Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("reverse order", async function (): Promise {
const q = new AsyncOrderedQueue();
let currID = 0;
return Promise.all([
q.push(doStuff(1, 400)).then(id => {
expect(currID).to.equal(0);
currID = id;
}),
q.push(doStuff(2, 300)).then(id => {
expect(currID).to.equal(1);
currID = id;
}),
q.push(doStuff(3, 200)).then(id => {
expect(currID).to.equal(2);
currID = id;
}),
q.push(doStuff(4, 100)).then(id => {
expect(currID).to.equal(3);