-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c7527e
commit f13722c
Showing
1 changed file
with
33 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
}) |