gristlabs_grist-core/test/client/models/rowuid.js
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

29 lines
799 B
JavaScript

/* global describe, it */
var assert = require('chai').assert;
var rowuid = require('app/client/models/rowuid');
describe('rowuid', function() {
it('should combine and split tableRefs with rowId', function() {
function verify(tableRef, rowId) {
var u = rowuid.combine(tableRef, rowId);
assert.equal(rowuid.tableRef(u), tableRef);
assert.equal(rowuid.rowId(u), rowId);
assert.equal(rowuid.toString(u), tableRef + ":" + rowId);
}
// Simple case.
verify(4, 17);
// With 0 for one or both of the parts.
verify(0, 17);
verify(1, 0);
verify(0, 0);
// Test with values close to the upper limits
verify(rowuid.MAX_TABLES - 1, 17);
verify(1234, rowuid.MAX_ROWS - 1);
verify(rowuid.MAX_TABLES - 1, rowuid.MAX_ROWS - 1);
});
});