Skip to content

Commit

Permalink
Remove flakey test
Browse files Browse the repository at this point in the history
  • Loading branch information
envex committed Nov 7, 2023
1 parent 1796062 commit 27755d7
Showing 1 changed file with 0 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,44 +103,4 @@ describe('fillMissingDataPoints', () => {
},
]);
});

it('loops through a large data set in less than 15ms', () => {
const data = getData();

const start = Date.now();
fillMissingDataPoints(data);
const elapsed = Date.now() - start;

expect(elapsed).toBeLessThan(15);
});
});

const DATA_SERIES_COUNT = 10;
const DATA_POINTS_COUNT = 500;

function getData() {
const largestArray: DataSeries[] = [];

for (let i = 1; i <= DATA_SERIES_COUNT; i++) {
const dataItems: DataPoint[] = [];
const randomOffset = getRandomNumber(0, DATA_POINTS_COUNT / 6);

for (let j = 1; j <= DATA_POINTS_COUNT - randomOffset; j++) {
const key = getRandomKey();
const value = getRandomNumber(0, 100);
dataItems.push({key, value});
}

largestArray.push({name: `Array ${i}`, data: dataItems});
}

return largestArray;

function getRandomNumber(min, max) {
return Math.random() * (max - min) + min;
}

function getRandomKey() {
return Math.random().toString(36).substring(7);
}
}

0 comments on commit 27755d7

Please sign in to comment.