describe('perf()', () => { describe('setPerformanceCollectionEnabled()', () => { it('true', async () => { await firebase.perf().setPerformanceCollectionEnabled(true); }); it('false', async () => { await firebase.perf().setPerformanceCollectionEnabled(false); }); it('errors if not boolean', async () => { (() => firebase.perf().setPerformanceCollectionEnabled()).should.throw( 'firebase.perf().setPerformanceCollectionEnabled() requires a boolean value' ); }); }); describe('newTrace()', () => { it('returns an instance of Trace', async () => { const trace = firebase.perf().newTrace('foo'); trace.constructor.name.should.be.equal('Trace'); }); it('errors if identifier not a string', async () => { (() => firebase.perf().newTrace([1, 2, 3, 4])).should.throw( 'firebase.perf().newTrace() requires a string value' ); }); }); describe('newHttpMetric()', () => { it('returns an instance of HttpMetric', async () => { <<<<<<< Updated upstream const trace = firebase.perf().newHttpMetric('foo', 'bar'); trace.constructor.name.should.be.equal('HttpMetric'); }); it('errors if url/httpMethod not a string', async () => { (() => firebase.perf().newHttpMetric(123, [1, 2])).should.throw( 'firebase.perf().newHttpMetric() requires url and httpMethod string values' ); ======= const trace = firebase.perf().newHttpMetric('foo', 'GET'); trace.constructor.name.should.be.equal('HttpMetric'); }); it('errors if url/httpMethod not a string', async () => { (() => firebase.perf().newHttpMetric(123, [1, 2])).should.throw( 'firebase.perf().newHttpMetric() requires url and httpMethod string values' ); }); it('errors if httpMethod not a valid type', async () => { (() => firebase.perf().newHttpMetric('foo', 'FOO')).should.throw(); // TODO error >>>>>>> Stashed changes }); }); });