From 06340d997e95b30f586f74503c64d115190b0d3b Mon Sep 17 00:00:00 2001 From: svariant Date: Fri, 2 Aug 2024 14:21:45 +0200 Subject: [PATCH] [PPANTT-42] fix: Unit tests --- .../__tests__/CommissionBundleDetailPage.test.tsx | 2 +- .../StationMaintenancesHoursSummary.test.tsx | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/pages/commisionalBundles/detail/__tests__/CommissionBundleDetailPage.test.tsx b/src/pages/commisionalBundles/detail/__tests__/CommissionBundleDetailPage.test.tsx index 8dcf5245d..b557f9def 100644 --- a/src/pages/commisionalBundles/detail/__tests__/CommissionBundleDetailPage.test.tsx +++ b/src/pages/commisionalBundles/detail/__tests__/CommissionBundleDetailPage.test.tsx @@ -137,7 +137,7 @@ describe(' for PSP', () => { test('render component CommissionBundleDetailPage bundle type PRIVATE', async () => { deleteMock.mockReturnValueOnce(new Promise((resolve) => resolve())); let bundle = { ...mockedCommissionBundlePspDetailPrivate }; - bundle.validityDateFrom = new Date(); + bundle.validityDateFrom = new Date("01/01/2020"); render( diff --git a/src/pages/stationMaintenances/list/__tests__/StationMaintenancesHoursSummary.test.tsx b/src/pages/stationMaintenances/list/__tests__/StationMaintenancesHoursSummary.test.tsx index 5ee7ac0fa..2c5e2920e 100644 --- a/src/pages/stationMaintenances/list/__tests__/StationMaintenancesHoursSummary.test.tsx +++ b/src/pages/stationMaintenances/list/__tests__/StationMaintenancesHoursSummary.test.tsx @@ -2,28 +2,21 @@ import { render } from '@testing-library/react'; import React from 'react'; import { Provider } from 'react-redux'; import StationMaintenancesHoursSummary from '../StationMaintenancesHoursSummary'; -import * as StationMaintenanceService from '../../../../services/stationMaintenancesService'; import { mockMaintenanceHoursSummary } from '../../../../services/__mocks__/stationMaintenancesService'; import { store } from '../../../../redux/store'; -const mockGetStationMaintenances = jest.spyOn( - StationMaintenanceService, - 'getBrokerMaintenancesSummary' -); describe('', () => { test('render StationMaintenancesHoursSummary', () => { - mockGetStationMaintenances.mockResolvedValueOnce(mockMaintenanceHoursSummary); render( - + ); }); test('render StationMaintenancesHoursSummary error getBrokerMaintenancesSummary', () => { - mockGetStationMaintenances.mockRejectedValueOnce("error"); render( - + ); });