mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
a52d56f613
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
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import {fromTableDataAction, TableDataAction, toTableDataAction} from 'app/common/DocActions';
|
|
import {assert} from 'chai';
|
|
|
|
describe('DocActions', function() {
|
|
|
|
it('should convert correctly with toTableDataAction', () => {
|
|
const colValues = {id: [2, 4, 6], foo: ["a", "b", "c"], bar: [false, "y", null]};
|
|
|
|
assert.deepEqual(toTableDataAction("Hello", colValues),
|
|
['TableData', "Hello", [2, 4, 6],
|
|
{ foo: ["a", "b", "c"], bar: [false, "y", null] }]);
|
|
|
|
// Make sure colValues that was passed-in didn't get changed.
|
|
assert.deepEqual(colValues,
|
|
{id: [2, 4, 6], foo: ["a", "b", "c"], bar: [false, "y", null]});
|
|
|
|
assert.deepEqual(toTableDataAction("Foo", {id: []}), ['TableData', "Foo", [], {}]);
|
|
});
|
|
|
|
it('should convert correctly with fromTableDataAction', () => {
|
|
const tableData: TableDataAction = ['TableData', "Hello", [2, 4, 6],
|
|
{ foo: ["a", "b", "c"], bar: [false, "y", null] }];
|
|
|
|
assert.deepEqual(fromTableDataAction(tableData),
|
|
{id: [2, 4, 6], foo: ["a", "b", "c"], bar: [false, "y", null]});
|
|
|
|
// Make sure tableData itself is unchanged.
|
|
assert.deepEqual(tableData, ['TableData', "Hello", [2, 4, 6],
|
|
{ foo: ["a", "b", "c"], bar: [false, "y", null] }]);
|
|
|
|
assert.deepEqual(fromTableDataAction(['TableData', "Foo", [], {}]), {id: []});
|
|
});
|
|
});
|