From 6711c4b80f499dae86ac7a5aab8f8de1569124ad Mon Sep 17 00:00:00 2001 From: Hallvard Andreas Stark Date: Mon, 11 Dec 2023 16:10:53 +0100 Subject: [PATCH] fix test --- .../fagsakprofile/FagsakProfileIndex.spec.tsx | 4 +- .../BehandlingPickerItemContent.spec.tsx | 41 +++++-------------- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/packages/sak-app/src/fagsakprofile/FagsakProfileIndex.spec.tsx b/packages/sak-app/src/fagsakprofile/FagsakProfileIndex.spec.tsx index dc2d072ccd..fa12bd11d9 100644 --- a/packages/sak-app/src/fagsakprofile/FagsakProfileIndex.spec.tsx +++ b/packages/sak-app/src/fagsakprofile/FagsakProfileIndex.spec.tsx @@ -191,8 +191,8 @@ describe('', () => { expect(screen.queryAllByTestId('BehandlingPickerItem').length).toBe(2); expect(screen.getByTestId('BehandlingPicker')).toBeInTheDocument(); expect(screen.getByText('123 - Opprettet')).toBeInTheDocument(); - expect(screen.getByText('Førstegangsbehandling')).toBeInTheDocument(); - expect(screen.getByText('Viderebehandling')).toBeInTheDocument(); + expect(screen.getByText('1. Førstegangsbehandling')).toBeInTheDocument(); + expect(screen.getByText('2. Viderebehandling')).toBeInTheDocument(); }); it('skal ikke vise alle behandlinger når behandling er valgt', async () => { diff --git a/packages/sak-behandling-velger/src/components/BehandlingPickerItemContent.spec.tsx b/packages/sak-behandling-velger/src/components/BehandlingPickerItemContent.spec.tsx index 4cf253aaf6..e6f6312968 100644 --- a/packages/sak-behandling-velger/src/components/BehandlingPickerItemContent.spec.tsx +++ b/packages/sak-behandling-velger/src/components/BehandlingPickerItemContent.spec.tsx @@ -1,32 +1,12 @@ +import { renderWithIntl } from '@fpsak-frontend/utils-test/src/test-utils'; +import { screen } from '@testing-library/react'; import React from 'react'; -import { shallow } from 'enzyme'; -import Panel from 'nav-frontend-paneler'; - -import { DateLabel } from '@fpsak-frontend/shared-components'; - +import messages from '../../i18n/nb_NO.json'; import BehandlingPickerItemContent from './BehandlingPickerItemContent'; describe('', () => { it('skal rendre komponent', () => { - const wrapper = shallow( - , - ); - expect(wrapper.find(Panel)).toHaveLength(1); - expect(wrapper.find(DateLabel)).toHaveLength(2); - }); - - it('skal vise avsluttet dato når denne finnes', () => { - const wrapper = shallow( + renderWithIntl( ', () => { søknadsperioder={[{ fom: '2022-01-01', tom: '2022-01-18' }]} erFerdigstilt erUnntaksløype={false} - index={0} + index={1} opprettet="2021-12-20T09:21:41" />, + { + locale: 'nb-NO', + messages, + }, ); - - const labels = wrapper.find(DateLabel); - expect(labels).toHaveLength(2); - expect(labels.first().prop('dateString')).toEqual('2022-01-01'); - expect(labels.last().prop('dateString')).toEqual('2022-01-18'); + expect(screen.getByText('1. Viderebehandling')).toBeInTheDocument(); + expect(screen.getByText('20.12.2021')).toBeInTheDocument(); }); });