function withStack( value, fn ) { stack.push( value ); fn(); stack.pop(); }
popState(state) { if (this.state !== state) { throw new Error(`Cannot popState ${ state } when in ${ this.state }`); } this.states.pop(); }
function retryStep(opts) { if (opts === undefined) opts = 1; recorder.retry(opts); // adding an empty promise to clear retries recorder.add(_ => null); // remove retry once the step passed recorder.add(_ => event.dispatcher.once(event.step.finished, _ => recorder.retries.pop())); return this; }
popState(state) { if (this.isState(state)) { this.states.pop(); } else { throw new Error(`Cannot pop the non-active state "${state}"`); } }
useFunctionContext(run) { const functionContext = last(this.functionContexts); this.runningContexts.push(functionContext); run(); this.runningContexts.pop(); }
test('11. Deletes a super admin user (successfully)', async () => { const user = testData.otherSuperAdminUsers.pop(); const res = await rq({ url: `/admin/users/${user.id}`, method: 'DELETE', }); expect(res.statusCode).toBe(200); expect(res.body.data).toMatchObject(user); });
newContext(run) { const newContext = Object.assign({ '@contextType': 'const/let' }, this.currentContext); this.contexts.push(newContext); this.runningContexts.push(newContext); run(); const { currentFunctionContext } = this; for (const p in currentFunctionContext) { if (!currentFunctionContext.hasOwnProperty(p) || newContext.hasOwnProperty(p)) continue; newContext[p] = currentFunctionContext[p]; } this.runningContexts.pop(); return newContext; }
tsFiles.map(f => { const s = f.split('.'); s.pop(); return `${s.join('.')}.js`; })
pop() { debug('Pop worker queue and execute'); const payload = this.queue.pop(); if (payload) { this.execute(payload); } else { this.running--; } }
/** * @param {string} name * @inner */ restore(name) { tasks.push('<---'); log(`${currentQueue()}Finalize <${name}> session`); this.running = false; sessionId = null; this.catch(errFn); promise = promise.then(() => oldPromises.pop()); }
setInterval(() => { while (t.length > 0) { t.pop(); } });
// Default jsonp settings jQuery.ajaxSetup( { jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } } );
test('11. Deletes a super admin user (successfully)', async () => { const user = testData.otherSuperAdminUsers.pop(); const res = await rq({ url: `/admin/users/${user.id}`, method: 'DELETE', }); expect(res.statusCode).toBe(200); expect(res.body.data).toMatchObject(user); });
pop() { debug('Pop worker queue and execute'); const payload = this.queue.pop(); if (payload) { this.execute(payload); } else { this.running--; } }