|
Jared K. Smith |
e912895 |
'use strict';
|
|
Jared K. Smith |
e912895 |
|
|
Jared K. Smith |
e912895 |
require('mocha');
|
|
Jared K. Smith |
e912895 |
var assert = require('assert');
|
|
Jared K. Smith |
e912895 |
var nanoseconds = require('./');
|
|
Jared K. Smith |
e912895 |
|
|
Jared K. Smith |
e912895 |
describe('nanoseconds', function () {
|
|
Jared K. Smith |
e912895 |
it('should convert to nanoseconds:', function () {
|
|
Jared K. Smith |
e912895 |
assert.equal(nanoseconds([0, 999]), 999);
|
|
Jared K. Smith |
e912895 |
assert.equal(nanoseconds([12, 999]), 12000000999);
|
|
Jared K. Smith |
e912895 |
assert.equal(nanoseconds([1298001, 09187662]), 1298001009187662);
|
|
Jared K. Smith |
e912895 |
});
|
|
Jared K. Smith |
e912895 |
|
|
Jared K. Smith |
e912895 |
it('should throw an error:', function () {
|
|
Jared K. Smith |
e912895 |
try {
|
|
Jared K. Smith |
e912895 |
nanoseconds();
|
|
Jared K. Smith |
e912895 |
} catch(err) {
|
|
Jared K. Smith |
e912895 |
assert(err);
|
|
Jared K. Smith |
e912895 |
assert(err.message);
|
|
Jared K. Smith |
e912895 |
assert(err.message === 'expected an array from process.hrtime()');
|
|
Jared K. Smith |
e912895 |
}
|
|
Jared K. Smith |
e912895 |
});
|
|
Jared K. Smith |
e912895 |
});
|