Fakultas Ilmu Komputer UI

Commit 243b1fa3 authored by Doan Andreas Nathanael's avatar Doan Andreas Nathanael
Browse files

[GREEN] resolve test errors because native modules

parent 06dd902e
......@@ -4,6 +4,8 @@ import { render } from '@testing-library/react-native';
import { ErrorToast } from './styles';
import App from '.';
jest.useFakeTimers();
describe('Application', () => {
it('renders correctly', () => {
render(<App />);
......
import { DietRecommendationRequest } from 'services/dietRecommendation/models';
import { TextFieldSchema } from 'types/form';
import { FieldType, FieldValidation } from 'utils/form';
export const textField: TextFieldSchema[] = [
{
label: 'Saran Gizi',
placeholder: 'Ex: Perbanyak makanan yang berserat...',
required: true,
name: 'nutritional_advice',
},
{
label: 'Saran Gaya Hidup',
placeholder: 'Ex: Tubuh Anda membutuhkan istirahat lebih...',
required: true,
name: 'lifestyle_advice',
},
];
export const initialValues: DietRecommendationRequest = {
client_plan_meal: '',
nutritional_advice: '',
lifestyle_advice: '',
};
export const fieldValidation: FieldValidation[] = [
{
name: 'nutritional_advice',
required: true,
label: 'Saran Gizi',
type: FieldType.TEXT,
},
{
name: 'lifestyle_advice',
required: true,
label: 'Saran Gaya Hidup',
type: FieldType.TEXT,
},
];
......@@ -4,6 +4,8 @@ import * as ROUTES from 'constants/routes';
import QuestionAnswerCard from '.';
jest.useFakeTimers();
describe('QuestionAnswerCard', () => {
it('renders correctly', () => {
render(
......
......@@ -2,7 +2,7 @@ import { FC, useState } from 'react';
import { Dimensions, ScrollView } from 'react-native';
import { styles } from './styles';
import { layoutStyles } from 'styles';
import { useRoute } from '@react-navigation/native';
import { useNavigation, useRoute } from '@react-navigation/native';
import React from 'react';
import { DietProfilePage } from './components';
import { CarouselPagination, BigButton, Loader } from 'components/core';
......@@ -12,12 +12,14 @@ import { useApi } from 'hooks';
import { retrieveDietQuestionnaireByIdApi } from 'services/dietQuestionnaire';
import { DietQuestionnaireResponse } from 'services/dietQuestionnaire/models';
import EmptyDataPage from 'components/core/EmptyDataPage';
import * as ROUTES from 'constants/routes';
interface QuestionnaireID {
id: number;
}
const ReadOnlyDietProfile: FC = () => {
const navigation = useNavigation();
const [activeSlide, setActiveSlide] = useState(0);
const route = useRoute();
const { id } = route.params as QuestionnaireID;
......@@ -25,6 +27,8 @@ const ReadOnlyDietProfile: FC = () => {
retrieveDietQuestionnaireByIdApi(id),
);
const dataDQR = data as DietQuestionnaireResponse;
if (!id) {
return <EmptyDataPage text="Klien belum mengisi diet questionnaire" />;
}
......@@ -50,9 +54,12 @@ const ReadOnlyDietProfile: FC = () => {
<CarouselPagination index={activeSlide} length={5} />
<BigButton
title="Berikan Rekomendasi"
onPress={() => {
// TODO: Doan
}}
onPress={() =>
navigation.navigate(ROUTES.profileDietRecommendation, {
name: dataDQR.user.name,
id: id,
})
}
/>
</ScrollView>
);
......
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