feat(web): make active tables sortable
DH V2 CI / API · typecheck, tests, build (push) Successful in 53s
Production dependency audit / API · production dependencies (push) Successful in 19s
Production dependency audit / WEB · production dependencies (push) Successful in 16s
DH V2 CI / WEB · typecheck, build (push) Successful in 1m34s
DH V2 CI / Docker / migrations / production images (push) Successful in 2m49s
DH V2 CI / Promote verified main to deploy (push) Successful in 3s
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 7m22s
DH V2 CI / API · typecheck, tests, build (push) Successful in 53s
Production dependency audit / API · production dependencies (push) Successful in 19s
Production dependency audit / WEB · production dependencies (push) Successful in 16s
DH V2 CI / WEB · typecheck, build (push) Successful in 1m34s
DH V2 CI / Docker / migrations / production images (push) Successful in 2m49s
DH V2 CI / Promote verified main to deploy (push) Successful in 3s
Android CI / RC / Android · lint, tests, debug APK, release compile (push) Successful in 7m22s
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
function collectTsx(directory: string): string[] {
|
||||
return readdirSync(directory).flatMap((name) => {
|
||||
const path = resolve(directory, name);
|
||||
return statSync(path).isDirectory() ? collectTsx(path) : name.endsWith('.tsx') ? [path] : [];
|
||||
});
|
||||
}
|
||||
|
||||
test('F6.17 uses one sortable table component for every active WEB table', () => {
|
||||
const webRoot = resolve(process.cwd(), '..', 'web-v2', 'src');
|
||||
const files = collectTsx(webRoot);
|
||||
const rawTables = files.filter((path) => !path.endsWith('components/SortableTable.tsx') && readFileSync(path, 'utf8').includes('<table'));
|
||||
assert.deepEqual(rawTables, []);
|
||||
|
||||
const sortableFiles = files.filter((path) => readFileSync(path, 'utf8').includes('<SortableTable'));
|
||||
assert.equal(sortableFiles.length, 24);
|
||||
const tableCount = sortableFiles.reduce((count, path) => count + (readFileSync(path, 'utf8').match(/<SortableTable/g)?.length ?? 0), 0);
|
||||
assert.equal(tableCount, 28);
|
||||
});
|
||||
|
||||
test('F6.17 sortable headers toggle direction and compare text, dates and numbers', () => {
|
||||
const source = readFileSync(resolve(process.cwd(), '..', 'web-v2', 'src', 'components', 'SortableTable.tsx'), 'utf8');
|
||||
assert.match(source, /aria-sort/);
|
||||
assert.match(source, /ascending/);
|
||||
assert.match(source, /descending/);
|
||||
assert.match(source, /dateValue/);
|
||||
assert.match(source, /numericPattern/);
|
||||
assert.match(source, /localeCompare\(right, 'es-AR'/);
|
||||
assert.match(source, /data-sortable/);
|
||||
});
|
||||
Reference in New Issue
Block a user