Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrozenberg committed May 20, 2024
1 parent 03d33c4 commit d960227
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/unit/test-error-reporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ describes.sandboxed('getErrorReportData', {}, (env) => {

beforeEach(() => {
onError = window.onerror;
nextRandomNumber = 0;
nextRandomNumber = 1;
env.sandbox.stub(Math, 'random').callsFake(() => nextRandomNumber);
self.__AMP_MODE = undefined;
});
Expand Down Expand Up @@ -500,7 +500,7 @@ describes.sandboxed('getErrorReportData', {}, (env) => {
});

it('should throttle user errors', () => {
nextRandomNumber = 0.2;
nextRandomNumber = 0.0099999;
let e = '';
allowConsoleError(() => {
try {
Expand All @@ -520,7 +520,7 @@ describes.sandboxed('getErrorReportData', {}, (env) => {
});

it('should not report load errors', () => {
nextRandomNumber = 1e-3 + 1e-4;
nextRandomNumber = 0.000099999;
const e = new Error('Failed to load:');
const data = getErrorReportData(
undefined,
Expand All @@ -533,7 +533,7 @@ describes.sandboxed('getErrorReportData', {}, (env) => {
});

it('should report throttled load errors at threshold', () => {
nextRandomNumber = 1e-4;
nextRandomNumber = 0.0001;
const e = new Error('Failed to load:');
const data = getErrorReportData(
undefined,
Expand All @@ -547,7 +547,7 @@ describes.sandboxed('getErrorReportData', {}, (env) => {
});

it('should not report Script errors', () => {
nextRandomNumber = 1e-3 + 1e-4;
nextRandomNumber = 0.000099999;
const e = new Error('Script error.');
const data = getErrorReportData(
undefined,
Expand All @@ -560,7 +560,7 @@ describes.sandboxed('getErrorReportData', {}, (env) => {
});

it('should report throttled Script errors at threshold', () => {
nextRandomNumber = 1e-4;
nextRandomNumber = 0.0001;
const e = new Error('Script error.');
const data = getErrorReportData(
undefined,
Expand All @@ -574,7 +574,7 @@ describes.sandboxed('getErrorReportData', {}, (env) => {
});

it('should report throttled load errors under threshold', () => {
nextRandomNumber = 1e-4 - 1e-5;
nextRandomNumber = 0.0001;
const e = new Error('Failed to load:');
const data = getErrorReportData(
undefined,
Expand Down

0 comments on commit d960227

Please sign in to comment.