update to latest standards

This commit is contained in:
2018-03-11 16:44:32 +01:00
parent 0dc3c1af46
commit ccce9dc04d
25 changed files with 477 additions and 399 deletions

18
test/test.timer.ts Normal file
View File

@ -0,0 +1,18 @@
// tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from 'tapbundle';
import { Timer } from '../ts/index';
let testTimer: Timer;
tap.test('should create a valid timer', async () => {
testTimer = new Timer(1000);
expect(testTimer).to.be.instanceof(Timer)
})
tap.test('should start timer', async () => {
testTimer.start()
await testTimer.completed;
})
tap.start()

View File

@ -1,36 +1,35 @@
import { expect, tap } from 'tapbundle'
import * as smarttime from '../ts/index'
import { expect, tap } from 'tapbundle';
import * as smarttime from '../ts/index';
// Test TimeStamp class
let testTimeStamp: smarttime.TimeStamp
let testTimeStamp2: smarttime.TimeStamp
tap.test('should create valid testTimeStamp instance', async (tools) => {
testTimeStamp = new smarttime.TimeStamp()
await tools.delayFor(2)
testTimeStamp2 = new smarttime.TimeStamp()
expect(testTimeStamp).to.be.instanceof(smarttime.TimeStamp)
expect(testTimeStamp).to.be.instanceof(smarttime.TimeStamp)
})
let testTimeStamp: smarttime.TimeStamp;
let testTimeStamp2: smarttime.TimeStamp;
tap.test('should create valid testTimeStamp instance', async tools => {
testTimeStamp = new smarttime.TimeStamp();
await tools.delayFor(2);
testTimeStamp2 = new smarttime.TimeStamp();
expect(testTimeStamp).to.be.instanceof(smarttime.TimeStamp);
expect(testTimeStamp).to.be.instanceof(smarttime.TimeStamp);
});
tap.test('should have valid linuxtime', async () => {
// tslint:disable-next-line:no-unused-expression
expect(testTimeStamp.isOlderThan(testTimeStamp2)).to.be.true
expect(testTimeStamp.isOlderThan(testTimeStamp2)).to.be.true;
// tslint:disable-next-line:no-unused-expression
expect(testTimeStamp.isYoungerThan(testTimeStamp2)).to.be.false
})
expect(testTimeStamp.isYoungerThan(testTimeStamp2)).to.be.false;
});
let testHrtMeasurement: smarttime.HrtMeasurement
let testHrtMeasurement: smarttime.HrtMeasurement;
// Test HrtMeasurement
tap.test('should create valid HrtMeasurements', async (tools) => {
testHrtMeasurement = new smarttime.HrtMeasurement()
testHrtMeasurement.start()
await tools.delayFor(20)
testHrtMeasurement.stop()
expect(testHrtMeasurement.milliSeconds).to.be.greaterThan(19)
expect(testHrtMeasurement.milliSeconds).to.be.lessThan(25)
})
tap.test('should create valid HrtMeasurements', async tools => {
testHrtMeasurement = new smarttime.HrtMeasurement();
testHrtMeasurement.start();
await tools.delayFor(20);
testHrtMeasurement.stop();
expect(testHrtMeasurement.milliSeconds).to.be.greaterThan(19);
expect(testHrtMeasurement.milliSeconds).to.be.lessThan(25);
});
// check units
tap.test('should combine units', async () => {
@ -41,8 +40,8 @@ tap.test('should combine units', async () => {
days: 2,
hours: 2,
minutes: 2
})
console.log(computedTime)
})
});
console.log(computedTime);
});
tap.start()
tap.start();