Add test for getCreationDate
All checks were successful
discord bot tests / discord bot tests (push) Successful in 12s
All checks were successful
discord bot tests / discord bot tests (push) Successful in 12s
This commit is contained in:
parent
4ca13712ed
commit
b36a71d517
1 changed files with 22 additions and 0 deletions
22
tests/getCreationDate.test.js
Normal file
22
tests/getCreationDate.test.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const getCreationDate = require('../util/getCreationDate');
|
||||||
|
|
||||||
|
const users = [
|
||||||
|
{ user: { createdAt: new Date("2016-01-29T14:47:58.915Z") } },
|
||||||
|
{ user: { createdAt: new Date("2018-08-20T15:51:47.090Z") } },
|
||||||
|
{ user: { createdAt: new Date("2019-04-08T21:08:11.212Z") } }
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
const humanReadableTime = [
|
||||||
|
"2016-01-29 14:47:58",
|
||||||
|
"2018-08-20 15:51:47",
|
||||||
|
"2019-04-08 21:08:11"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
test('Testing getCreationDate', () => {
|
||||||
|
for(let i = 0; i < users.length; i++){
|
||||||
|
expect(getCreationDate(users[i])).toBe(humanReadableTime[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue