const startPerformanceTracking = ( name, { fullPageLoad = false } = {} ) => { if ( isPerformanceTrackingEnabled() ) { start( name, { fullPageLoad } ); } }
async componentDidMount() { NProgress.start(); try { const { slug } = this.props; const book = await getBookDetail({ slug }); this.setState({ book, loading: false }); // eslint-disable-line NProgress.done(); } catch (err) { this.setState({ loading: false, error: err.message || err.toString() }); // eslint-disable-line NProgress.done(); } }
it('should disable & clear timing after ready', function* () { const json = app.timing.toJSON(); assert(json.length === 0); app.timing.start('a'); app.timing.end('a'); const json2 = app.timing.toJSON(); assert(json2.length === 0); });
initReader() { this.reader.on('items', this.handleFeedItems.bind(this)); this.reader.on('error', error => { console.log('Feed reader error:', error); }); this.reader.start(); }
/** * @public * @description Start all services * @returns {Promise} - Resolve when all services are started. * @example * service.startAll(); */ async function startAll() { return Promise.all(Object.keys(this.getServices()).map((serviceKey) => this.start(serviceKey))); }
describe('xiaomiService', () => { const xiaomiService = XiaomiService({}, '3ac129d9-a610-42f8-924f-3fe708001b3d'); it('should start service', async () => { await xiaomiService.start(); }); it('should stop service', async () => { await xiaomiService.stop(); }); });
async containerLazyInit() { return new GenericContainer('postgres', '9.6.8') .withEnv('POSTGRES_USER', 'root') .withEnv('POSTGRES_DB', 'model_test') .withExposedPorts(this.port()) .start(); }
it('should return error, unable to contact third party provider', async () => { const OpenWeatherService = proxyquire('../../../services/openweather/index', brokenAxios); const openWeatherService = OpenWeatherService(gladys, '35deac79-f295-4adf-8512-f2f48e1ea0f8'); await openWeatherService.start(); const promise = openWeatherService.weather.get({ latitude: 12, longitude: 10, }); return assert.isRejected(promise, 'REQUEST_TO_THIRD_PARTY_FAILED'); });
static async fromPageStart( id: string, collectors: Collector[] = [] ) { const report = new ReportImpl( id, true ); await report.start( collectors ); return report; }
it('should start service', async () => { const OpenWeatherService = proxyquire('../../../services/openweather/index', workingAxiosClear); const openWeatherService = OpenWeatherService(gladys, '35deac79-f295-4adf-8512-f2f48e1ea0f8'); await openWeatherService.start(); });
describe('ExampleService lifecycle', () => { const exampleService = ExampleService(); it('should start the service', async () => { await exampleService.start(); }); it('should stop the service', async () => { await exampleService.stop(); }); });
async componentDidMount() { NProgress.start(); try { const { slug } = this.props; const book = await getBookDetail({ slug }); this.setState({ book, loading: false }); // eslint-disable-line NProgress.done(); } catch (err) { this.setState({ loading: false, error: err.message || err.toString() }); // eslint-disable-line NProgress.done(); } }
async componentDidMount() { NProgress.start(); try { const { slug } = this.props; const book = await getBookDetail({ slug }); this.setState({ book }); // eslint-disable-line NProgress.done(); } catch (err) { this.setState({ error: err.message || err.toString() }); // eslint-disable-line NProgress.done(); } }
async componentDidMount() { NProgress.start(); const { slug } = this.props; try { const book = await getBookDetail({ slug }); this.setState({ book }); // eslint-disable-line NProgress.done(); } catch (err) { this.setState({ error: err.message || err.toString() }); // eslint-disable-line NProgress.done(); } }