- let ctx;
-
- beforeEach(function () {
- ctx = {};
- });
-
- describe('dateOrNot', function () {
- let date, otherwise;
- beforeEach(function () {
- date = new Date();
- otherwise = 'otherwise';
- });
- it('covers', function () {
- const result = th.dateOrNot(date, otherwise);
- assert.strictEqual(result, date.toString());
- });
- it('covers no date', function () {
- date = undefined;
- const result = th.dateOrNot(date, otherwise);
- assert.strictEqual(result, otherwise);
- });
- it('covers ms', function () {
- const result = th.dateOrNot(date.getTime(), otherwise);
- assert.strictEqual(result, date.toString());
- });
- it('covers naught', function () {
- const result = th.dateOrNot(0, otherwise);
- assert.strictEqual(result, otherwise);
- });
- it('covers the infinite', function () {
- const result = th.dateOrNot(-Infinity, otherwise);
- assert.strictEqual(result, otherwise);
- });
- }); // dateOrNot
-
- describe('secondsToPeriod', function () {
- it('covers seconds', function () {
- const result = th.secondsToPeriod(45);
- assert.strictEqual(result, '45 seconds');
- });
- it('covers minutes', function () {
- const result = th.secondsToPeriod(105);
- assert.strictEqual(result, '1 minute 45 seconds');
- });
- it('covers hours', function () {
- const result = th.secondsToPeriod(3705);
- assert.strictEqual(result, '1 hour 1 minute 45 seconds');
- });
- it('covers days', function () {
- const result = th.secondsToPeriod(90105);
- assert.strictEqual(result, '1 day 1 hour 1 minute 45 seconds');
- });
- it('covers months', function () {
- const result = th.secondsToPeriod(5274105);
- assert.strictEqual(result, '2 months 1 day 1 hour 1 minute 45 seconds');
- });
- }); // secondsToPeriod