Fakultas Ilmu Komputer UI

index.test.tsx 870 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import React from 'react';
import { render } from 'utils/testing';
import * as ROUTES from 'constants/routes';

import ProgramDetail from '.';
import { dietPrograms } from 'constants/dietelaProgram';
import { DietelaProgram } from 'services/dietelaQuiz/quizResult';

describe('ProgramDetail', () => {
  const id = DietelaProgram.GOALS_1;

  it('shows program details content correctly', () => {
    const { getByText } = render(<ProgramDetail />, ROUTES.programDetail, {
      id: id,
    });
    const programDetail = dietPrograms[id].details;

    const description = getByText(programDetail.description);
    expect(description).toBeTruthy();

    const firstDetail = programDetail.details[0];
    expect(getByText(firstDetail.title)).toBeTruthy();

    const secondDetail = programDetail.details[1];
    expect(getByText(secondDetail.title)).toBeTruthy();
  });
});