mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(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
This commit is contained in:
32
test/client/ui/AccountPage.ts
Normal file
32
test/client/ui/AccountPage.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import {checkName} from 'app/client/ui/AccountPage';
|
||||
import {assert} from 'chai';
|
||||
|
||||
|
||||
describe("AccountPage", function() {
|
||||
describe("isValidName", function() {
|
||||
it("should detect invalid name", function() {
|
||||
|
||||
assert.equal(checkName('santa'), true);
|
||||
assert.equal(checkName('_santa'), true);
|
||||
assert.equal(checkName("O'Neil"), true);
|
||||
assert.equal(checkName("Emily"), true);
|
||||
assert.equal(checkName("santa(2)"), true);
|
||||
assert.equal(checkName("Dr. noname"), true);
|
||||
assert.equal(checkName("santa-klaus"), true);
|
||||
assert.equal(checkName("Noémie"), true);
|
||||
assert.equal(checkName("张伟"), true);
|
||||
|
||||
assert.equal(checkName(',,__()'), false);
|
||||
assert.equal(checkName('<foo>'), false);
|
||||
assert.equal(checkName('<foo>'), false);
|
||||
assert.equal(checkName('(bar)'), false);
|
||||
assert.equal(checkName('foo <baz>'), false);
|
||||
assert.equal(checkName('-foo'), false);
|
||||
assert.equal(checkName("'foo"), false);
|
||||
assert.equal(checkName(' Bob'), false);
|
||||
|
||||
assert.equal(checkName('='), false);
|
||||
assert.equal(checkName('santa='), false);
|
||||
});
|
||||
});
|
||||
});
|
||||
37
test/client/ui/DocumentSettings.ts
Normal file
37
test/client/ui/DocumentSettings.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/* global describe, it */
|
||||
|
||||
import { timezoneOptionsImpl } from "app/client/widgets/TZAutocomplete";
|
||||
import { assert } from "chai";
|
||||
import * as momentTimezone from 'moment-timezone';
|
||||
|
||||
describe('DocumentSettings', function() {
|
||||
|
||||
describe("timezoneOptionsImpl", function() {
|
||||
it("should return zones in correct order", function() {
|
||||
// let's test ordering of zones at time the test was written (Tue Jul 18 12:04:56.641 2017)
|
||||
const now = 1500393896641;
|
||||
assert.deepEqual(timezoneOptionsImpl(now, [
|
||||
"Pacific/Marquesas",
|
||||
"US/Aleutian",
|
||||
"America/Juneau",
|
||||
"America/Anchorage",
|
||||
"Antarctica/Mawson",
|
||||
"Asia/Calcutta",
|
||||
"Asia/Colombo",
|
||||
"Africa/Accra",
|
||||
"Antarctica/Casey"
|
||||
], momentTimezone).map(({label}) => label), [
|
||||
"(GMT-09:30) Pacific/Marquesas",
|
||||
"(GMT-09:00) US/Aleutian",
|
||||
"(GMT-08:00) America/Anchorage",
|
||||
"(GMT-08:00) America/Juneau",
|
||||
"(GMT+00:00) Africa/Accra",
|
||||
"(GMT+05:00) Antarctica/Mawson",
|
||||
"(GMT+05:30) Asia/Calcutta",
|
||||
"(GMT+05:30) Asia/Colombo",
|
||||
"(GMT+11:00) Antarctica/Casey"
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
18
test/client/ui/UserImage.ts
Normal file
18
test/client/ui/UserImage.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import {getInitials} from 'app/client/ui/UserImage';
|
||||
import {assert} from 'chai';
|
||||
|
||||
describe('AppModel', function() {
|
||||
describe('getInitials', function() {
|
||||
it('should extract initials', () => {
|
||||
assert.equal(getInitials({name: "Foo Bar"}), "FB");
|
||||
assert.equal(getInitials({name: " foo bar cat"}), "fb");
|
||||
assert.equal(getInitials({name: " foo-bar cat"}), "fc");
|
||||
assert.equal(getInitials({name: "foo-bar"}), "f");
|
||||
assert.equal(getInitials({name: " Something"}), "S");
|
||||
assert.equal(getInitials({name: " Something", email: 'test@...'}), "S");
|
||||
assert.equal(getInitials({name: "", email: 'test@...'}), "t");
|
||||
assert.equal(getInitials({name: " ", email: 'test@...'}), "t");
|
||||
assert.equal(getInitials({email: 'something@example.com'}), "s");
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user