Skip to content

Commit

Permalink
fix: fixing commented tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felipebrsk committed Sep 20, 2024
1 parent 0c7527e commit f13722c
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions src/utils/date.helpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
// import { formatRelativeDateOnly } from './date.helpers'
import { formatRelativeDateOnly } from './date.helpers'

// describe('formatRelativeDateOnly()', () => {
// it('formats past dates correctly', () => {
// const pastDate = new Date('2023-01-02')
// const baseDate = new Date('2023-01-10')
describe('formatRelativeDateOnly()', () => {
it('formats past dates correctly', () => {
const pastDate = new Date('2023-01-02')
const baseDate = new Date('2023-01-10')

// const result = formatRelativeDateOnly(pastDate, baseDate)
const result = formatRelativeDateOnly(pastDate, baseDate)

// expect(result).toBe('01/02/2023')
// })
expect(result).toBe('01/02/2023')
})

// it('formats future dates correctly', () => {
// const futureDate = new Date('2023-01-20')
// const baseDate = new Date('2023-01-10')
it('formats future dates correctly', () => {
const futureDate = new Date('2023-01-20')
const baseDate = new Date('2023-01-10')

// const result = formatRelativeDateOnly(futureDate, baseDate)
const result = formatRelativeDateOnly(futureDate, baseDate)

// expect(result).toBe('01/20/2023')
// })
expect(result).toBe('01/20/2023')
})

// it('returns x weekday if dates are close', () => {
// const pastDate = new Date('2023-01-08')
// const baseDate = new Date('2023-01-10')
it('returns x weekday if dates are close', () => {
const pastDate = new Date('2023-01-08')
const baseDate = new Date('2023-01-10')

// const result = formatRelativeDateOnly(pastDate, baseDate)
const result = formatRelativeDateOnly(pastDate, baseDate)

// expect(result).toBe('last Sunday')
// })
expect(result).toBe('last Sunday')
})

// it('returns today for the current date', () => {
// const today = new Date()
// const result = formatRelativeDateOnly(today)
it('returns today for the current date', () => {
const today = new Date()
const result = formatRelativeDateOnly(today)

// expect(result).toBe('today')
// })
expect(result).toBe('today')
})

// it('handles invalid date inputs', () => {
// const invalidDate = 'invalid date string'
// const baseDate = new Date()
it('handles invalid date inputs', () => {
const invalidDate = 'invalid date string'
const baseDate = new Date()

// expect(() =>
// formatRelativeDateOnly(invalidDate as any, baseDate),
// ).toThrow()
// })
// })
expect(() =>
formatRelativeDateOnly(invalidDate as any, baseDate),
).toThrow()
})
})

0 comments on commit f13722c

Please sign in to comment.