Fakultas Ilmu Komputer UI

Commit 00b94a14 authored by doanandreas's avatar doanandreas
Browse files

[GREEN] add further testing for profile diet recommendation

parent 11c94481
Pipeline #78625 passed with stages
in 28 minutes and 13 seconds
import { UserRole } from 'services/auth/models';
import { Client } from 'services/profiles/models';
export const mockClientList: Client[] = [
{
user: {
id: 1,
name: 'Doan Di Dinding',
email: 'doan@dinding.com',
role: UserRole.CLIENT,
},
diet_profile_id: 1,
diet_questionnaire_id: 1,
diet_recommendation_id: 1,
},
];
import React from 'react';
import { render } from 'utils/testing';
import { render, waitFor } from 'utils/testing';
import * as ROUTES from 'constants/routes';
import ProfileDietRecommendation from '.';
jest.mock('react-native-toast-message');
jest.mock('axios');
jest.mock('react-native-document-picker');
describe('ProfileDietRecommendation', () => {
it('renders correctly', () => {
render(<ProfileDietRecommendation />, ROUTES.profileDietRecommendation, {
......@@ -13,4 +17,23 @@ describe('ProfileDietRecommendation', () => {
},
});
});
it('shows correct name', async () => {
const { queryByText } = render(
<ProfileDietRecommendation />,
ROUTES.profileDietRecommendation,
{
routeParams: {
name: 'Doan',
id: 1,
},
},
);
await waitFor(() => expect(queryByText(/Rekomendasi/i)).toBeTruthy());
});
afterAll(() => {
jest.clearAllMocks();
});
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment