Fakultas Ilmu Komputer UI

index.test.tsx 785 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
import React from 'react';
import { render } from 'utils/testing';
import * as ROUTES from 'constants/routes';

import ReadOnlyDietProfile from '.';
import { mockDietQuestionnaire } from '__mocks__/dietQuestionnaire';

describe('ReadOnlyDietProfile', () => {
  it('renders correctly', () => {
    render(<ReadOnlyDietProfile />, ROUTES.clientProfileNutritionist, {
      routeParams: mockDietQuestionnaire,
    });
  });
14
15
16
17
18
19
20
21
22
23
  it('shows "Klien belum mengisi diet questionnaire" text if no questionnaire answer is provided yet', () => {
    const { getByText } = render(
      <ReadOnlyDietProfile />,
      ROUTES.clientProfileNutritionist,
      {
        routeParams: { id: null },
      },
    );
    expect(getByText(/Klien belum mengisi diet questionnaire/i)).toBeTruthy();
  });
24
});