-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
3 changed files
with
68 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--require ts-node/register | ||
--require test/setup.ts | ||
--recursive | ||
--exit |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
import * as chai from 'chai'; | ||
// @ts-ignore | ||
import * as dirtyChai from 'dirty-chai'; | ||
import * as chaiAsPromised from 'chai-as-promised'; | ||
import * as path from 'path'; | ||
// @ts-ignore | ||
import * as mod from 'module'; | ||
// @ts-ignore | ||
import * as sinon from 'sinon'; | ||
// @ts-ignore | ||
import * as sinonChai from 'sinon-chai'; | ||
|
||
chai.use(sinonChai); | ||
chai.use(chaiAsPromised); | ||
chai.use(dirtyChai); | ||
|
||
(global as any).should = chai.should(); | ||
(global as any).sinon = sinon; | ||
|
||
// importing files with ../../../../../.. makes my brain hurt | ||
process.env.NODE_PATH = path.join(__dirname, '..') + path.delimiter + (process.env.NODE_PATH || ''); | ||
// @ts-ignore | ||
mod._initPaths(); |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
import {CronicleClient} from '../../dist/'; | ||
import moment = require('moment'); | ||
import {expect} from 'chai'; | ||
|
||
describe('index', () => { | ||
|
||
describe('timing helpers ', () => { | ||
|
||
it('should create timing object from moment', () => { | ||
const timing = CronicleClient.getUtcTiming(moment.utc('2016-05-26T14:50:50.900Z')); | ||
expect(timing.years![0]).to.eq(2016); | ||
expect(timing.months![0]).to.eq(5); | ||
expect(timing.days![0]).to.eq(26); | ||
expect(timing.hours![0]).to.eq(14); | ||
expect(timing.minutes![0]).to.eq(50); | ||
}); | ||
|
||
it('should create timing object from date', () => { | ||
const timing = CronicleClient.getUtcTiming(new Date('2016-05-26T14:50:50.900Z')); | ||
expect(timing.years![0]).to.eq(2016); | ||
expect(timing.months![0]).to.eq(5); | ||
expect(timing.days![0]).to.eq(26); | ||
expect(timing.hours![0]).to.eq(14); | ||
expect(timing.minutes![0]).to.eq(50); | ||
}); | ||
|
||
it('should create timing object from string', () => { | ||
const timing = CronicleClient.getUtcTiming('2016-05-26T14:50:50.900Z'); | ||
expect(timing.years![0]).to.eq(2016); | ||
expect(timing.months![0]).to.eq(5); | ||
expect(timing.days![0]).to.eq(26); | ||
expect(timing.hours![0]).to.eq(14); | ||
expect(timing.minutes![0]).to.eq(50); | ||
}); | ||
|
||
}); | ||
}); |