Skip to content

Commit

Permalink
Debug timeToFirstByte unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Viewtiful committed Oct 2, 2020
1 parent 907a9c7 commit 08bb298
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/spec/modules/teadsBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,15 @@ describe('teadsBidAdapter', () => {
if (ttfbExpectedV2) {
expect(payload.timeToFirstByte).to.deep.equal(ttfbExpectedV2.toString());
} else {
const ttfbExpectedV1 = performance.timing.responseStart - performance.timing.requestStart;

expect(payload.timeToFirstByte).to.deep.equal(ttfbExpectedV1.toString());
const ttfbWithTimingV1 = performance &&
performance.timing.responseStart &&
performance.timing.requestStart &&
performance.timing.responseStart >= 0 &&
performance.timing.requestStart >= 0 &&
performance.timing.responseStart - performance.timing.requestStart;
const ttfbExpectedV1 = ttfbWithTimingV1 ? ttfbWithTimingV1.toString() : '';

expect(payload.timeToFirstByte).to.deep.equal(ttfbExpectedV1);
}
});

Expand Down

0 comments on commit 08bb298

Please sign in to comment.