HarborForge.Frontend: proposal/essential tests on current branch head #11

Merged
hzhang merged 13 commits from pr/dev-2026-03-29-frontend-tests-20260405 into main 2026-04-05 22:07:47 +00:00
Showing only changes of commit a431711ff0 - Show all commits

View File

@@ -26,6 +26,12 @@ interface TimeSlotResponse {
updated_at: string | null
}
interface DayViewResponse {
date: string
user_id: number
slots: TimeSlotResponse[]
}
interface SchedulePlanResponse {
id: number
slot_type: SlotType
@@ -41,6 +47,10 @@ interface SchedulePlanResponse {
updated_at: string | null
}
interface PlanListResponse {
plans: SchedulePlanResponse[]
}
interface WorkloadWarning {
period: string
slot_type: string
@@ -111,8 +121,8 @@ export default function CalendarPage() {
setLoading(true)
setError('')
try {
const { data } = await api.get<TimeSlotResponse[]>(`/calendar/day?date=${date}`)
setSlots(data)
const { data } = await api.get<DayViewResponse>(`/calendar/day?date=${date}`)
setSlots(Array.isArray(data?.slots) ? data.slots : [])
} catch (err: any) {
setError(err.response?.data?.detail || 'Failed to load calendar')
setSlots([])
@@ -123,8 +133,8 @@ export default function CalendarPage() {
const fetchPlans = async () => {
try {
const { data } = await api.get<SchedulePlanResponse[]>('/calendar/plans')
setPlans(data)
const { data } = await api.get<PlanListResponse>('/calendar/plans')
setPlans(Array.isArray(data?.plans) ? data.plans : [])
} catch (err: any) {
console.error('Failed to load plans:', err)
}