Skip to content

Commit

Permalink
task form, removed task details card, task logs app
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
  • Loading branch information
aaronchongth committed Dec 13, 2024
1 parent a67cc3b commit 4962120
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 134 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { fireEvent, screen, within } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { TaskForm } from './task-form';

import { RmfApiProvider } from '../../hooks';
import { MockRmfApi, render, TestProviders } from '../../utils/test-utils.test';

const mockUser = 'mock_user';
const mockFleets = {
fleet_1: ['robot_1'],
fleet_2: ['robot_2', 'robot_3'],
};
const mockCleanZones = ['clean_zone_1', 'clean_zone_2'];
const mockWaypoints = ['waypoint_1', 'waypoint_2', 'waypoint_3'];
const mockPickupZones = ['pickup_zone_1', 'pickup_zone_2'];
const mockCartIds = ['cart_1', 'cart_2', 'cart_3'];
const mockPickupPoints = {
pickup_1: 'handler_1',
pickup_2: 'handler_2',
};
const mockDropoffPoints = {
dropoff_1: 'handler_3',
dropoff_2: 'handler_4',
};

const onDispatchTask = vi.fn();
const onScheduleTask = vi.fn();
const onEditScheduleTask = vi.fn();
const onSuccess = vi.fn();
const onFail = vi.fn();
const onSuccessFavoriteTask = vi.fn();
const onFailFavoriteTask = vi.fn();
const submitFavoriteTask = vi.fn();
const deleteFavoriteTask = vi.fn();
const onSuccessScheduling = vi.fn();
const onFailScheduling = vi.fn();

describe('Task form', () => {
const rmfApi = new MockRmfApi();
// mock out some api calls so they never resolves
rmfApi.doorsApi.postDoorRequestDoorsDoorNameRequestPost = () => new Promise(() => {});
const Base = (props: React.PropsWithChildren<{}>) => {
return (
<TestProviders>
<RmfApiProvider value={rmfApi}>{props.children}</RmfApiProvider>
</TestProviders>
);
};

it('Task form renders', async () => {
render(
<Base>
<TaskForm
user={mockUser}
fleets={mockFleets}
// taskToDisplay
cleaningZones={mockCleanZones}
patrolWaypoints={mockWaypoints}
pickupZones={mockPickupZones}
cartIds={mockCartIds}
pickupPoints={mockPickupPoints}
dropoffPoints={mockDropoffPoints}
favoritesTasks={[]}
// schedule={}
// taskRequest={}
onDispatchTask={onDispatchTask}
onScheduleTask={onScheduleTask}
onEditScheduleTask={onEditScheduleTask}
onSuccess={onSuccess}
onFail={onFail}
onSuccessFavoriteTask={onSuccessFavoriteTask}
onFailFavoriteTask={onFailFavoriteTask}
submitFavoriteTask={submitFavoriteTask}
deleteFavoriteTask={deleteFavoriteTask}
onSuccessScheduling={onSuccessScheduling}
onFailScheduling={onFailScheduling}
open={true}
/>
</Base>,
);
});
});

This file was deleted.

0 comments on commit 4962120

Please sign in to comment.