This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { dateKey, habitWeek, isHabitComplete, isTaskView, numericHabitInputValue } from './mvp-utils'
|
||||
import { dateKey, habitWeek, isHabitComplete, isTaskView, numericHabitInputValue, shouldToggleHabitSwipe } from './mvp-utils'
|
||||
|
||||
describe('MVP view utilities', () => {
|
||||
it('formats a local date as YYYY-MM-DD', () => {
|
||||
@@ -28,4 +28,11 @@ describe('MVP view utilities', () => {
|
||||
expect(numericHabitInputValue('')).toBeNull()
|
||||
expect(numericHabitInputValue(4)).toBe(4)
|
||||
})
|
||||
|
||||
it('toggles a habit only for a deliberate horizontal swipe', () => {
|
||||
expect(shouldToggleHabitSwipe(78, 8)).toBe(true)
|
||||
expect(shouldToggleHabitSwipe(-78, 8)).toBe(false)
|
||||
expect(shouldToggleHabitSwipe(30, 2)).toBe(false)
|
||||
expect(shouldToggleHabitSwipe(80, 35)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user