Skip to content

Commit

Permalink
lint time table creator test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaebradley committed Oct 18, 2017
1 parent 29f728c commit 1f2b0b8
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions test/services/tables/TimeTableCreatorTest.js
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);
})
});
});

0 comments on commit 1f2b0b8

Please sign in to comment.