MVP frontend+backend

This commit is contained in:
2026-06-14 09:58:30 +02:00
parent d9539f23cc
commit 772d853e37
56 changed files with 5099 additions and 207 deletions
+7 -7
View File
@@ -11,12 +11,12 @@ describe('usePlannedDays', () => {
})
it('initializes with null data', () => {
const { result } = renderHook(() => usePlannedDays(null))
const { result } = renderHook(() => usePlannedDays())
expect(result.current.data).toBeNull()
expect(result.current.isLoading).toBe(false)
})
it('fetches planned days when both ids provided', async () => {
it('fetches planned days when childId provided', async () => {
const mockData = [
{
id: '1',
@@ -33,19 +33,19 @@ describe('usePlannedDays', () => {
vi.mocked(api.getPlannedDays).mockResolvedValue(mockData as any)
renderHook(() => usePlannedDays('ws1', 'child1'))
renderHook(() => usePlannedDays('child1'))
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0))
})
expect(api.getPlannedDays).toHaveBeenCalledWith('ws1', 'child1')
expect(api.getPlannedDays).toHaveBeenCalledWith('child1')
})
it('does not fetch without childId', () => {
vi.mocked(api.getPlannedDays).mockResolvedValue([])
renderHook(() => usePlannedDays('ws1'))
renderHook(() => usePlannedDays())
expect(api.getPlannedDays).not.toHaveBeenCalled()
})
@@ -66,7 +66,7 @@ describe('usePlannedDays', () => {
vi.mocked(api.createPlannedDay).mockResolvedValue(mockAdded as any)
vi.mocked(api.getPlannedDays).mockResolvedValue([mockAdded])
renderHook(() => usePlannedDays('ws1', 'child1'))
renderHook(() => usePlannedDays('child1'))
await act(async () => {
// just test that add can be called; mocks handle the result
@@ -79,7 +79,7 @@ describe('usePlannedDays', () => {
vi.mocked(api.deletePlannedDay).mockResolvedValue(undefined)
vi.mocked(api.getPlannedDays).mockResolvedValue([])
const { result } = renderHook(() => usePlannedDays('ws1', 'child1'))
const { result } = renderHook(() => usePlannedDays('child1'))
await act(async () => {
await result.current.remove('pd1')