mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Update test case for sortBy, select, orderBy component
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { render, act } from '@testing-library/react';
|
||||
import * as userServices from '@service/userServices';
|
||||
import * as roomServices from '@service/roomServices';
|
||||
import App from '../../App';
|
||||
|
||||
jest.mock('@service/userServices');
|
||||
jest.mock('@service/roomServices');
|
||||
|
||||
describe('App', () => {
|
||||
test('Should init room, user data', async () => {
|
||||
const mockGetUserNotBooked = jest.spyOn(userServices, 'getUserNotBooked');
|
||||
const mockGetRoomAvailable = jest.spyOn(roomServices, 'getRoomsAvailable');
|
||||
|
||||
mockGetUserNotBooked.mockResolvedValue([
|
||||
{
|
||||
id: 1,
|
||||
name: 'Nezumi',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Loi Phan',
|
||||
},
|
||||
]);
|
||||
|
||||
mockGetRoomAvailable.mockResolvedValue([
|
||||
{
|
||||
id: 1,
|
||||
name: 'Room 1',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Room 2',
|
||||
},
|
||||
]);
|
||||
|
||||
await act(async () => {
|
||||
render(<App />);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user