Fakultas Ilmu Komputer UI

index.test.tsx 757 Bytes
Newer Older
1
2
3
4
import React from 'react';
import { render } from '@testing-library/react-native';

import Questionnaire2 from '.';
Wulan Mantiri's avatar
Wulan Mantiri committed
5
import { mockDietQuestionnaire } from 'mocks/dietQuestionnaire';
6
7
import { mockUserContext } from 'mocks/userContext';
import { UserContext } from 'provider';
8
9
10
11
12
13

const mockedNavigate = jest.fn();

jest.mock('@react-navigation/native', () => {
  return {
    useNavigation: () => ({
14
      reset: mockedNavigate,
15
16
17
18
19
    }),
  };
});

describe('Questionnaire2', () => {
20
21
22
23
  const userProviderValues = {
    ...mockUserContext,
  };

24
  it('renders correctly', () => {
25
26
27
28
29
    render(
      <UserContext.Provider value={userProviderValues}>
        <Questionnaire2 route={{ params: mockDietQuestionnaire }} />
      </UserContext.Provider>,
    );
30
31
  });
});