diff --git a/src/lib/tradingView/dydxfeed/__test__/utils.spec.ts b/src/lib/tradingView/dydxfeed/__test__/utils.spec.ts index b4952bd71..5bb1e8701 100644 --- a/src/lib/tradingView/dydxfeed/__test__/utils.spec.ts +++ b/src/lib/tradingView/dydxfeed/__test__/utils.spec.ts @@ -1,6 +1,8 @@ import { ResolutionString } from 'public/tradingview/charting_library'; import { describe, expect, it } from 'vitest'; +import { timeUnits } from '@/constants/time'; + import { getBarTime } from '../utils'; describe('getBarTime', () => { @@ -8,15 +10,15 @@ describe('getBarTime', () => { const beginningOfChart = getBarTime(0, 0, '1' as ResolutionString); expect(beginningOfChart).toBe(0); - const middleOfChart = getBarTime(0, 10001, '1' as ResolutionString); - expect(middleOfChart).toBe(10); + const middleOfChart = getBarTime(0, timeUnits.minute * 10 + 1, '1' as ResolutionString); + expect(middleOfChart).toBe(600); }); it('should return the correct value when times dont start at 0', () => { // Intervals here look like 100, 1100, ... 9100, 10100, .etc // Should resolve to 9100ms bucket which is 9s - const nonZeroStart = getBarTime(100, 10001, '1' as ResolutionString); - expect(nonZeroStart).toBe(9); + const nonZeroStart = getBarTime(100, timeUnits.minute * 10 + 1, '1' as ResolutionString); + expect(nonZeroStart).toBe(540); }); it('should return correct value with real timestamps', () => {