[perf] Implement tests
This commit is contained in:
parent
dd0c86aed5
commit
dfa7b7ca41
|
@ -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,
|
||||
];
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
Loading…
Reference in New Issue