diff --git a/tests/shared/functions.spec.js b/tests/shared/functions.spec.js index b153906..156f9b0 100644 --- a/tests/shared/functions.spec.js +++ b/tests/shared/functions.spec.js @@ -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') @@ -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) }) })