[perf] Implement tests

This commit is contained in:
Elliot Hesp 2017-05-24 17:02:25 +01:00
parent dd0c86aed5
commit dfa7b7ca41
3 changed files with 37 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import messaging from './messaging/index';
import storage from './storage/index';
import auth from './auth/index';
import config from './config/index';
import performance from './perf/index';
const testSuiteInstances = [
database,
@ -15,6 +16,7 @@ const testSuiteInstances = [
crash,
storage,
config,
performance,
];
/*

View File

@ -0,0 +1,10 @@
import firebase from '../../firebase';
import TestSuite from '../../../lib/TestSuite';
import performanceTests from './performanceTests';
const suite = new TestSuite('Performance Monitoring', 'firebase.perf()', firebase);
suite.addTests(performanceTests);
export default suite;

View File

@ -0,0 +1,25 @@
function messagingTests({ fdescribe, it, firebase }) {
fdescribe('Performance Monitoring', () => {
it('it should return a new Task instance', () => {
const trace = firebase.native.perf().newTrace('foo');
trace.should.be.an.Object();
trace.should.have.a.property('start').which.is.a.Function();
trace.should.have.a.property('incrementCounter').which.is.a.Function();
trace.should.have.a.property('stop').which.is.a.Function();
return Promise.resolve();
});
it('it should start an instance, increment and stop', () => {
const trace = firebase.native.perf().newTrace('bar');
trace.start();
trace.incrementCounter('foobar');
trace.stop();
return Promise.resolve();
});
});
}
export default messagingTests;