chore: use amount const in tests
This commit is contained in:
parent
7725de7483
commit
429b8a1ec4
2 changed files with 11 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
import {describe, it, expect, vi, afterEach, beforeEach} from 'vitest'
|
||||
import {
|
||||
AMOUNTS_IN_SECONDS,
|
||||
getDefaultReminderSettings,
|
||||
getSavedReminderSettings,
|
||||
parseSavedReminderAmount,
|
||||
|
@ -36,25 +37,25 @@ describe('Default Reminder Save', () => {
|
|||
|
||||
describe('Default Reminder Load', () => {
|
||||
it('Should parse minutes', () => {
|
||||
const settings = parseSavedReminderAmount(5 * 60)
|
||||
const settings = parseSavedReminderAmount(5 * AMOUNTS_IN_SECONDS.minutes)
|
||||
|
||||
expect(settings.amount).toBe(5)
|
||||
expect(settings.type).toBe('minutes')
|
||||
})
|
||||
it('Should parse hours', () => {
|
||||
const settings = parseSavedReminderAmount(5 * 60 * 60)
|
||||
const settings = parseSavedReminderAmount(5 * AMOUNTS_IN_SECONDS.hours)
|
||||
|
||||
expect(settings.amount).toBe(5)
|
||||
expect(settings.type).toBe('hours')
|
||||
})
|
||||
it('Should parse days', () => {
|
||||
const settings = parseSavedReminderAmount(5 * 60 * 60 * 24)
|
||||
const settings = parseSavedReminderAmount(5 * AMOUNTS_IN_SECONDS.days)
|
||||
|
||||
expect(settings.amount).toBe(5)
|
||||
expect(settings.type).toBe('days')
|
||||
})
|
||||
it('Should parse months', () => {
|
||||
const settings = parseSavedReminderAmount(5 * 60 * 60 * 24 * 30)
|
||||
const settings = parseSavedReminderAmount(5 * AMOUNTS_IN_SECONDS.months)
|
||||
|
||||
expect(settings.amount).toBe(5)
|
||||
expect(settings.type).toBe('months')
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
const DEFAULT_REMINDER_KEY = 'defaultReminder'
|
||||
|
||||
const AMOUNTS_IN_SECONDS: { [key: string]: number } = {
|
||||
export const AMOUNTS_IN_SECONDS: {
|
||||
minutes: number,
|
||||
hours: number,
|
||||
days: number,
|
||||
months: number,
|
||||
} = {
|
||||
minutes: 60,
|
||||
hours: 60 * 60,
|
||||
days: 60 * 60 * 24,
|
||||
|
|
Loading…
Reference in a new issue