Add routine management features for child and parent views
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m8s
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m8s
- Implemented routine child-mode flow tests to ensure proper functionality of routine assignment and task completion. - Created notification tests for parent view to verify routine completion notifications for children. - Developed ChildRoutineOverlay component for displaying routine tasks and handling user interactions. - Added RoutineApproveDialog component for approving or rejecting completed routines. - Created unit tests for ChildRoutineOverlay and RoutineEditView components to ensure correct behavior and rendering. - Enhanced RoutineEditView with proper handling of task addition and form submission. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -65,6 +65,23 @@ describe('ChildView', () => {
|
||||
custom_value: 8,
|
||||
}
|
||||
|
||||
const mockRoutine = {
|
||||
id: 'routine-1',
|
||||
name: 'Morning Routine',
|
||||
points: 12,
|
||||
image_id: 'routine-image',
|
||||
image_url: '/images/routine.png',
|
||||
items: [
|
||||
{
|
||||
id: 'routine-item-1',
|
||||
routine_id: 'routine-1',
|
||||
name: 'Make Bed',
|
||||
image_id: null,
|
||||
order: 0,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
|
||||
@@ -212,6 +229,34 @@ describe('ChildView', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Routine Overlay', () => {
|
||||
beforeEach(async () => {
|
||||
wrapper = mount(ChildView)
|
||||
await nextTick()
|
||||
await new Promise((resolve) => setTimeout(resolve, 50))
|
||||
})
|
||||
|
||||
it('opens the routine overlay when a routine is clicked', async () => {
|
||||
vi.useFakeTimers()
|
||||
|
||||
wrapper.vm.handleRoutineClick(mockRoutine)
|
||||
vi.advanceTimersByTime(200)
|
||||
await nextTick()
|
||||
|
||||
expect(wrapper.vm.showRoutineOverlay).toBe(true)
|
||||
expect(wrapper.vm.dialogRoutine?.id).toBe('routine-1')
|
||||
|
||||
vi.useRealTimers()
|
||||
})
|
||||
|
||||
it('speaks the routine task name when a routine task is clicked', () => {
|
||||
wrapper.vm.handleRoutineTaskClick(mockRoutine.items[0])
|
||||
|
||||
expect(window.speechSynthesis.cancel).toHaveBeenCalled()
|
||||
expect(window.speechSynthesis.speak).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Reward Triggering', () => {
|
||||
beforeEach(async () => {
|
||||
wrapper = mount(ChildView)
|
||||
|
||||
Reference in New Issue
Block a user