Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hallvardastark committed Dec 11, 2023
1 parent 2e503c6 commit 6711c4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ describe('<FagsakProfileIndex>', () => {
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 () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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('<BehandlingPickerItemContent>', () => {
it('skal rendre komponent', () => {
const wrapper = shallow(
<BehandlingPickerItemContent
behandlingTypeNavn="Viderebehandling"
behandlingsresultatTypeNavn="Innvilget"
behandlingsresultatTypeKode="INNVILGET"
erAutomatiskRevurdering={false}
søknadsperioder={[{ fom: '2022-01-01', tom: '2022-01-18' }]}
erFerdigstilt
erUnntaksløype={false}
index={0}
opprettet="2021-12-20T09:21:41"
/>,
);
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(
<BehandlingPickerItemContent
behandlingTypeNavn="Viderebehandling"
behandlingsresultatTypeNavn="Innvilget"
Expand All @@ -35,14 +15,15 @@ describe('<BehandlingPickerItemContent>', () => {
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();
});
});

0 comments on commit 6711c4b

Please sign in to comment.