Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidFyon committed Aug 2, 2024
1 parent 647744f commit 29a48dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/synapse-bridge/src/rules/notBeforeToday/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { defaultErrorMessages } from './locales'
import { isDateBefore } from '../../functions/validation/isDateBefore'
import { TODAY } from '../../constants'

function formatDateToDDMMYYYY(date: Date): string {
export function formatDateToDDMMYYYY(date: Date): string {
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0');
const year = date.getFullYear();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from 'dayjs'

import { notBeforeToday, notBeforeTodayFn } from '../'
import { notBeforeToday, notBeforeTodayFn, formatDateToDDMMYYYY } from '../'
import { describe, it, expect } from 'vitest'

const DATE_FORMAT = 'DD/MM/YYYY'
Expand Down Expand Up @@ -33,4 +33,9 @@ describe('notBeforeToday', () => {
it('returns true when value is today', () => {
expect(notBeforeToday(today)).toBe(true)
})

it('returns date in DD/MM/YYYY format', () => {
const date = new Date('2021-01-01')
expect(formatDateToDDMMYYYY(date)).toBe('01/01/2021')
})
})

0 comments on commit 29a48dc

Please sign in to comment.