mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-21 23:53:52 +00:00
Fix test to use Date
This commit is contained in:
parent
43d6ae3884
commit
d94c2e72be
|
@ -1,6 +1,6 @@
|
||||||
import { binData } from '@/shared/charts/binCount';
|
import { binData } from '@/shared/charts/binCount';
|
||||||
|
|
||||||
describe.only('binCount.ts', () => {
|
describe('binCount.ts', () => {
|
||||||
it('Bins data as expected', () => {
|
it('Bins data as expected', () => {
|
||||||
const testData = [1, 1, 2, 3, 5, 6, 8, 10];
|
const testData = [1, 1, 2, 3, 5, 6, 8, 10];
|
||||||
const res = binData(testData, 3);
|
const res = binData(testData, 3);
|
||||||
|
@ -37,10 +37,10 @@ describe.only('binCount.ts', () => {
|
||||||
it('Bins data performant', () => {
|
it('Bins data performant', () => {
|
||||||
const randomSize = 20000;
|
const randomSize = 20000;
|
||||||
const randomData = Array.from({ length: randomSize }, () => Math.floor(Math.random() * 10));
|
const randomData = Array.from({ length: randomSize }, () => Math.floor(Math.random() * 10));
|
||||||
const startTime = performance.now();
|
const startTime = Date.now();
|
||||||
const res = binData(randomData, 5);
|
const res = binData(randomData, 5);
|
||||||
|
|
||||||
const endTime = performance.now();
|
const endTime = Date.now();
|
||||||
expect(endTime - startTime).toBeLessThan(20);
|
expect(endTime - startTime).toBeLessThan(20);
|
||||||
|
|
||||||
expect(res.map((v) => v[1]).reduce((a, b) => a + b)).toEqual(randomData.length);
|
expect(res.map((v) => v[1]).reduce((a, b) => a + b)).toEqual(randomData.length);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user