Skip to content

Commit

Permalink
test: Fix inconsistant format I18n tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Merkur39 committed Mar 31, 2023
1 parent e659a9b commit e1e4631
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions react/I18n/format.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ describe('formatLocallyDistanceToNow', () => {
})

describe('formatLocallyDistanceToNowStrict', () => {
afterEach(() => {
MockDate.reset()
})

it('should formatDistanceToNowStrict with small value', () => {
MockDate.set('2023-01-01T00:00:00')
const date = Date.now() + 29 * 1000 // 29s

const result = formatLocallyDistanceToNowStrict(date)
Expand All @@ -62,6 +67,7 @@ describe('formatLocallyDistanceToNowStrict', () => {
})

it('should formatDistanceToNowStrict with medium value', () => {
MockDate.set('2023-01-01T00:00:00')
const date = Date.now() + (44 * 60 + 31) * 1000 // 44min 31s

const result = formatLocallyDistanceToNowStrict(date)
Expand All @@ -70,6 +76,7 @@ describe('formatLocallyDistanceToNowStrict', () => {
})

it('should formatDistanceToNowStrict with high value', () => {
MockDate.set('2023-01-01T00:00:00')
const date = Date.now() + (89 * 60 + 31) * 1000 // 89min 31s

const result = formatLocallyDistanceToNowStrict(date)
Expand All @@ -78,6 +85,7 @@ describe('formatLocallyDistanceToNowStrict', () => {
})

it('should formatDistanceToNowStrict with one day', () => {
MockDate.set('2023-01-01T00:00:00')
const date = Date.now() + 24 * 60 * 60 * 1000 // 1d

const result = formatLocallyDistanceToNowStrict(date)
Expand All @@ -86,6 +94,7 @@ describe('formatLocallyDistanceToNowStrict', () => {
})

it('should formatDistanceToNowStrict with two days', () => {
MockDate.set('2023-01-01T00:00:00')
const date = Date.now() + 2 * 24 * 60 * 60 * 1000 // 2d

const result = formatLocallyDistanceToNowStrict(date)
Expand All @@ -94,6 +103,7 @@ describe('formatLocallyDistanceToNowStrict', () => {
})

it('should formatDistanceToNowStrict with very high value', () => {
MockDate.set('2023-01-01T00:00:00')
const date = Date.now() + 42 * 24 * 60 * 60 * 1000 // 42d

const result = formatLocallyDistanceToNowStrict(date)
Expand Down

0 comments on commit e1e4631

Please sign in to comment.