gristlabs_grist-core/test/client/models/HomeModel.ts
Jarosław Sadziński a52d56f613 (core) Moving client and common tests to core
Summary:
- Moved /test/client and /test/common to core.
- Moved two files (CircularArray and RecentItems) from app/common to core/app/common.
- Moved resetOrg test to gen-server.
- `testrun.sh` is now invoking common and client test from core.
- Added missing packages to core's package.json (and revealed underscore as it is used in the main app).
- Removed Coord.js as it is not used anywhere.

Test Plan: Existing tests

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3590
2022-08-23 19:20:10 +02:00

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');
});
});
});