mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
23 lines
781 B
TypeScript
23 lines
781 B
TypeScript
|
import {getTimeFromNow} from 'app/client/models/HomeModel';
|
||
|
import {assert} from 'chai';
|
||
|
import moment from 'moment';
|
||
|
|
||
|
describe("HomeModel", function() {
|
||
|
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');
|
||
|
});
|
||
|
});
|
||
|
});
|