Fakultas Ilmu Komputer UI

index.test.tsx 627 Bytes
Newer Older
1
import React from 'react';
2
import { render, waitFor } from 'utils/testing';
3
import * as ROUTES from 'constants/routes';
4
import axios from 'axios';
5
6
7

import ClientListNutritionist from '.';

8
9
10
jest.mock('axios');
const mockAxios = axios as jest.Mocked<typeof axios>;

11
describe('ClientListNutritionist', () => {
12
13
14
15
16
17
18
  it('renders correctly', async () => {
    mockAxios.request.mockImplementationOnce(() =>
      Promise.resolve({
        status: 200,
        data: [],
      }),
    );
19
    render(<ClientListNutritionist />, ROUTES.clientListForNutritionist);
20
    await waitFor(() => expect(mockAxios.request).toBeCalled());
21
22
  });
});