mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-06-05 21:59:25 +02:00
first commit
This commit is contained in:
42
source/connector-mobilizon/front/date-time-wrapper-test.js
Normal file
42
source/connector-mobilizon/front/date-time-wrapper-test.js
Normal file
@ -0,0 +1,42 @@
|
||||
import test from 'ava';
|
||||
import { DateTimeWrapper } from './date-time-wrapper';
|
||||
|
||||
test('#getShortDate usual date', t => {
|
||||
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
||||
t.is(d.getShortDate(), '24/12/2020')
|
||||
})
|
||||
|
||||
test('#get24Time usual time', t => {
|
||||
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
||||
t.is(d.get24Time(), '17:45')
|
||||
})
|
||||
|
||||
test('#equalsDate same date, different time', t => {
|
||||
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
||||
const e = new DateTimeWrapper('2020-12-24T17:46:01Z')
|
||||
t.true(d.equalsDate(e))
|
||||
})
|
||||
|
||||
test('#equalsDate different date, different time', t => {
|
||||
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
||||
const e = new DateTimeWrapper('2021-11-25T17:46:01Z')
|
||||
t.false(d.equalsDate(e))
|
||||
})
|
||||
|
||||
test('#equalsDate different day, different time', t => {
|
||||
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
||||
const e = new DateTimeWrapper('2020-12-25T17:46:01Z')
|
||||
t.false(d.equalsDate(e))
|
||||
})
|
||||
|
||||
test('#equalsDate different month, different time', t => {
|
||||
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
||||
const e = new DateTimeWrapper('2020-11-24T17:46:01Z')
|
||||
t.false(d.equalsDate(e))
|
||||
})
|
||||
|
||||
test('#equalsDate different year, different time', t => {
|
||||
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
||||
const e = new DateTimeWrapper('2021-12-24T17:46:01Z')
|
||||
t.false(d.equalsDate(e))
|
||||
})
|
Reference in New Issue
Block a user