Skip to content

Commit

Permalink
Fixed render time-based test (#781)
Browse files Browse the repository at this point in the history
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
  • Loading branch information
marcopiraccini authored Jun 25, 2024
1 parent f906f51 commit 849bc30
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/renderer/utilityDetails.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ test('return label donwloads', async () => {
})

test('return label released At', async () => {
expect('54 years ago').toEqual(getLabelReleasedAt('0'))
expect('54 years ago').toEqual(getLabelReleasedAt(0))
expect('54 years ago').toEqual(getLabelReleasedAt(0))
const today = new Date()
const oneDay = 1000 * 60 * 60 * 24
const result = Math.round((today.getTime() / oneDay))
const numberOfDaysSinceEpoch = result.toFixed(0)
const numberOfYearsSinceEpoch = (numberOfDaysSinceEpoch / 365).toFixed(0)

expect(`${numberOfYearsSinceEpoch} years ago`).toEqual(getLabelReleasedAt('0'))
expect(`${numberOfYearsSinceEpoch} years ago`).toEqual(getLabelReleasedAt(0))
expect(`${numberOfYearsSinceEpoch} years ago`).toEqual(getLabelReleasedAt(0))
expect('-').toEqual(getLabelReleasedAt('-'))
expect('-').toEqual(getLabelReleasedAt(null))
expect('-').toEqual(getLabelReleasedAt(undefined))
Expand Down

0 comments on commit 849bc30

Please sign in to comment.