Skip to content

Commit

Permalink
refactor(apple): add dateutils class (nation3#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
aahna-ashina committed Oct 16, 2022
1 parent 293fc43 commit f7d00b5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/utils/DateUtils.test.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import { describe, expect, test } from '@jest/globals'
import { getTimeInSeconds, getDate } from './DateUtils'
import { DateUtils } from './DateUtils'

describe('getTimeInSeconds', () => {
test('getTimeInSeconds - 2022-09-30T04:12:17Z', () => {
const date: Date = new Date('2022-09-30T04:12:17Z')
console.log('date:', date)
expect(getTimeInSeconds(date)).toBe(1664511137)
expect(DateUtils.getTimeInSeconds(date)).toBe(1664511137)
})

test('getTimeInSeconds - 2022-09-30T04:12:17.000Z', () => {
const date: Date = new Date('2022-09-30T04:12:17.000Z')
console.log('date:', date)
expect(getTimeInSeconds(date)).toBe(1664511137)
expect(DateUtils.getTimeInSeconds(date)).toBe(1664511137)
})

test('getTimeInSeconds - 2022-09-30T04:12:17.499Z', () => {
const date: Date = new Date('2022-09-30T04:12:17.499Z')
console.log('date:', date)
expect(getTimeInSeconds(date)).toBe(1664511137)
expect(DateUtils.getTimeInSeconds(date)).toBe(1664511137)
})

test('getTimeInSeconds - 2022-09-30T04:12:17.500Z', () => {
const date: Date = new Date('2022-09-30T04:12:17.500Z')
console.log('date:', date)
expect(getTimeInSeconds(date)).toBe(1664511138)
expect(DateUtils.getTimeInSeconds(date)).toBe(1664511138)
})
})

describe('getDate', () => {
test('getDate - 1662889385', () => {
const date: Date = getDate(1662889385)
const date: Date = DateUtils.getDate(1662889385)
console.log('date:', date)
expect(date.toISOString()).toBe('2022-09-11T09:43:05.000Z')
})
Expand Down

0 comments on commit f7d00b5

Please sign in to comment.