You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
780 B
23 lines
780 B
5 months ago
|
import {getTimeFromNow} from 'app/client/lib/timeUtils';
|
||
2 years ago
|
import {assert} from 'chai';
|
||
|
import moment from 'moment';
|
||
|
|
||
5 months ago
|
describe("timeUtils", function() {
|
||
2 years ago
|
describe("getTimeFromNow", function() {
|
||
|
it("should give good summary of time that just passed", function() {
|
||
|
const t = moment().subtract(10, 's');
|
||
|
assert.equal(getTimeFromNow(t.toISOString()), 'a few seconds ago');
|
||
|
});
|
||
|
|
||
|
it("should gloss over times slightly in future", function() {
|
||
|
const t = moment().add(2, 's');
|
||
|
assert.equal(getTimeFromNow(t.toISOString()), 'a few seconds ago');
|
||
|
});
|
||
|
|
||
|
it("should not gloss over times further in future", function() {
|
||
|
const t = moment().add(2, 'minutes');
|
||
|
assert.equal(getTimeFromNow(t.toISOString()), 'in 2 minutes');
|
||
|
});
|
||
5 months ago
|
});
|
||
2 years ago
|
});
|