diff --git a/packages/trader/src/AppV2/Containers/Positions/positions-content.tsx b/packages/trader/src/AppV2/Containers/Positions/positions-content.tsx index 5713dc82cedd..bb4012e24101 100644 --- a/packages/trader/src/AppV2/Containers/Positions/positions-content.tsx +++ b/packages/trader/src/AppV2/Containers/Positions/positions-content.tsx @@ -49,7 +49,6 @@ const PositionsContent = observer(({ hasButtonsDemo, isClosedTab, setHasButtonsD onMount: onClosedTabMount, onUnmount: onClosedTabUnmount, } = useReportsStore().profit_table; - // console.log('data', data); const closedPositions = React.useMemo(() => data.map(d => ({ contract_info: d })), [data]); const positions = React.useMemo( () => (isClosedTab ? closedPositions : active_positions), diff --git a/packages/trader/src/Stores/Modules/Positions/__tests__/positions-store.spec.ts b/packages/trader/src/Stores/Modules/Positions/__tests__/positions-store.spec.ts index bc14c6a066a7..6df59122edbc 100644 --- a/packages/trader/src/Stores/Modules/Positions/__tests__/positions-store.spec.ts +++ b/packages/trader/src/Stores/Modules/Positions/__tests__/positions-store.spec.ts @@ -48,4 +48,39 @@ describe('PositionsStore', () => { expect(mockedPositionsStore.customTimeRangeFilter).toEqual(''); }); }); + describe('setDateFrom', () => { + it('should set dateFrom', () => { + mockedPositionsStore.setDateFrom(123424262); + expect(mockedPositionsStore.dateFrom).toEqual(123424262); + mockedPositionsStore.setDateFrom(null); + expect(mockedPositionsStore.dateFrom).toEqual(null); + }); + }); + describe('setDateTo', () => { + it('should set dateTo', () => { + mockedPositionsStore.setDateTo(12346779); + expect(mockedPositionsStore.dateTo).toEqual(12346779); + mockedPositionsStore.setDateTo(null); + expect(mockedPositionsStore.dateTo).toEqual(null); + }); + }); + describe('onUnmount', () => { + it('should reset all filters, when onUnmount is called', () => { + mockedPositionsStore.setDateTo(12346779); + mockedPositionsStore.setDateFrom(123424262); + mockedPositionsStore.setCustomTimeRangeFilter('25 May 2024'); + mockedPositionsStore.setTimeFilter('All time'); + mockedPositionsStore.setOpenContractTypeFilter(['Rise/Fall']); + mockedPositionsStore.setClosedContractTypeFilter(['Accumulators']); + + mockedPositionsStore.onUnmount(); + + expect(mockedPositionsStore.dateTo).toEqual(null); + expect(mockedPositionsStore.dateFrom).toEqual(null); + expect(mockedPositionsStore.customTimeRangeFilter).toEqual(''); + expect(mockedPositionsStore.timeFilter).toEqual(''); + expect(mockedPositionsStore.openContractTypeFilter).toEqual([]); + expect(mockedPositionsStore.closedContractTypeFilter).toEqual([]); + }); + }); });