UNPKG

timing2

Version:

The state-of-art web performance metrics collector based on High Resolution Time API

22 lines (19 loc) 633 B
const expect = require('chai').expect; const describe = require('mocha').describe; const it = require('mocha').it; const timing2 = require('../lib'); describe('get metrics', () => { it('should not throw when no performance', () => { expect(timing2).to.be.undefined; }); it('should work', () => { global.window = {}; global.window.location = {}; global.window.performance = {}; global.window.performance.timing = {}; global.window.performance.navigation = {}; delete require.cache[require.resolve('../lib')]; const timing2 = require('../lib'); expect(timing2).to.be.an('object'); }); });