Skip to content

Commit

Permalink
test: fix getFormattedDateByUnixTime assertions fail
Browse files Browse the repository at this point in the history
  • Loading branch information
eriandev committed Jun 2, 2022
1 parent f53d859 commit 6b005cd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/shared/functions.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { describe, expect, it } from 'vitest'
import { MONTHS_LIST } from '@/shared/constants'
import { getConditionByCode, getFormattedDateByUnixTime } from '@/shared/functions'
import weatherCodes from '@/assets/weather_codes.json'

const date = new Date(1654137000 * 1000)
const monthNumber = date.getMonth()
const dayNumber = date.getDate()
const year = date.getFullYear()
const formattedDate = `${MONTHS_LIST[monthNumber]} ${dayNumber}, ${year}`

describe('getConditionByCode function', () => {
it('should return empty string', () => {
const result = getConditionByCode('1654137000')
Expand All @@ -22,6 +29,6 @@ describe('getFormattedDateByUnixTime function', () => {

it('should return the expected result', () => {
const result = getFormattedDateByUnixTime(1654137000)
expect(result).toEqual('June 1, 2022')
expect(result).toEqual(formattedDate)
})
})

1 comment on commit 6b005cd

@vercel
Copy link

@vercel vercel bot commented on 6b005cd Jun 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

weather-app – ./

weather-app-git-main-erianvc.vercel.app
weather-app-erianvc.vercel.app
erianvc-weather-app.vercel.app

Please sign in to comment.