-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29f728c
commit 1f2b0b8
Showing
1 changed file
with
16 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
import {expect} from 'chai'; | ||
import { expect } from 'chai'; | ||
|
||
import moment from 'moment-timezone'; | ||
|
||
import FormattedDateTime from '../../../src/data/FormattedDateTime'; | ||
import TimeTableCreator from '../../../src/services/tables/TimeTableCreator'; | ||
import TimeUnit from '../../../src/data/TimeUnit'; | ||
|
||
describe('Test Time Table Creator', function() { | ||
let dateTime = moment().year(2016) | ||
.month(0) | ||
.date(1) | ||
.startOf('day'); | ||
describe('Test Time Table Creator', () => { | ||
const dateTime = moment() | ||
.year(2016) | ||
.month(0) | ||
.date(1) | ||
.startOf('day'); | ||
|
||
let formattedDateTime = new FormattedDateTime({ | ||
const formattedDateTime = new FormattedDateTime({ | ||
instant: dateTime, | ||
unit: TimeUnit.SECOND | ||
unit: TimeUnit.SECOND, | ||
}); | ||
|
||
it('should test table creation', function() { | ||
let expected = '┌───────────┬─────────────────────────────────────────┐\n│ UTC │ Fri., Jan. 5th, 2016 12:00:00 AM +00:00 │\n├───────────┼─────────────────────────────────────────┤\n│ UTC │ Fri., Jan. 5th, 2016 12:00:00 AM +00:00 │\n├───────────┼─────────────────────────────────────────┤\n│ Timestamp │ 1451606400 │\n├───────────┼─────────────────────────────────────────┤\n│ Unit │ second │\n└───────────┴─────────────────────────────────────────┘'; | ||
let table = TimeTableCreator.createTimestampTable(formattedDateTime); | ||
it('should test table creation', () => { | ||
const expected = '┌───────────┬─────────────────────────────────────────┐\n│ UTC │ Fri., Jan. 5th, 2016 12:00:00 AM +00:00 │\n├───────────┼─────────────────────────────────────────┤\n│ UTC │ Fri., Jan. 5th, 2016 12:00:00 AM +00:00 │\n├───────────┼─────────────────────────────────────────┤\n│ Timestamp │ 1451606400 │\n├───────────┼─────────────────────────────────────────┤\n│ Unit │ second │\n└───────────┴─────────────────────────────────────────┘'; | ||
const table = TimeTableCreator.createTimestampTable(formattedDateTime); | ||
|
||
console.log(expected); | ||
console.log(table); | ||
console.log(expected); // eslint-disable-line no-console | ||
console.log(table); // eslint-disable-line no-console | ||
expect(table).to.eql(expected); | ||
}); | ||
|
||
it('should test error when creating table', function() { | ||
it('should test error when creating table', () => { | ||
expect(() => TimeTableCreator.createTimestampTable(1)).to.throw(TypeError); | ||
}) | ||
}); | ||
}); |