-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task form, removed task details card, task logs app
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
- Loading branch information
1 parent
a67cc3b
commit 4962120
Showing
3 changed files
with
82 additions
and
134 deletions.
There are no files selected for viewing
86 changes: 0 additions & 86 deletions
86
packages/rmf-dashboard-framework/src/components/tasks/task-details-card.tsx
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
packages/rmf-dashboard-framework/src/components/tasks/task-form.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>, | ||
); | ||
}); | ||
}); |
48 changes: 0 additions & 48 deletions
48
packages/rmf-dashboard-framework/src/components/tasks/task-logs-app.tsx
This file was deleted.
Oops, something went wrong.