This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { dateKey, defaultView, habitWeek, isHabitComplete, isHabitScheduledToday, isTaskView, nextHabitSwipeValue, numericHabitInputValue, previousHabitSwipeValue, shouldToggleRowSwipe } from './mvp-utils'
|
||||
import { dateKey, defaultView, habitWeek, isHabitComplete, isHabitScheduledToday, isTaskView, nextHabitSwipeValue, numericHabitInputValue, previousHabitSwipeValue, quickTaskFields, shouldToggleRowSwipe } from './mvp-utils'
|
||||
|
||||
describe('MVP view utilities', () => {
|
||||
it('formats a local date as YYYY-MM-DD', () => {
|
||||
@@ -33,6 +33,20 @@ describe('MVP view utilities', () => {
|
||||
expect(defaultView()).toBe('today')
|
||||
})
|
||||
|
||||
it('quick-adds Today tasks to Inbox at noon in Asia/Shanghai', () => {
|
||||
const now = new Date('2026-09-05T16:30:00.000Z')
|
||||
expect(quickTaskFields('today', 'selected-list', 'inbox-list', now)).toEqual({
|
||||
list_id: 'inbox-list',
|
||||
due_at: '2026-09-06T12:00:00+08:00',
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps quick-add tasks in the selected list outside Today', () => {
|
||||
expect(quickTaskFields('tasks', 'selected-list', 'inbox-list', new Date('2026-09-05T16:30:00.000Z'))).toEqual({
|
||||
list_id: 'selected-list',
|
||||
})
|
||||
})
|
||||
|
||||
it('only includes scheduled, unpaused habits today regardless of kind or completion', () => {
|
||||
const day = '2026-09-06'
|
||||
expect(isHabitScheduledToday({ kind: 'boolean', cells: [{ day, scheduled: true, paused: false, value: true }] }, day)).toBe(true)
|
||||
|
||||
Reference in New Issue
Block a user