ci/woodpecker/push/woodpecker Pipeline was successful
Refactor asset drilldowns with combined dimension filters, parent summaries and progressive loading. Add the hidden /who read-only permission preview with scoped authorization, identity mapping and audit logging. Refine inventory counts and AI问数 presentation.
23 lines
1.2 KiB
TypeScript
23 lines
1.2 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { getPathSet, getRouteKey, resolveCanonicalUrl } from './routing.js';
|
|
|
|
test('normalizes legacy asset paths without losing search parameters', () => {
|
|
assert.equal(resolveCanonicalUrl({ pathname: '/mileage', search: '?date=2026-08-12', hash: '' }), '/asset?date=2026-08-12#mileage');
|
|
assert.equal(resolveCanonicalUrl({ pathname: '/unknown', search: '?x=1', hash: '#mileage' }), '/asset?x=1#mileage');
|
|
});
|
|
test('keeps canonical and hidden administration paths unchanged', () => {
|
|
assert.equal(resolveCanonicalUrl({ pathname: '/asset', search: '', hash: '#assets' }), null);
|
|
assert.equal(resolveCanonicalUrl({ pathname: '/admin/feedback', search: '', hash: '' }), null);
|
|
assert.equal(resolveCanonicalUrl({ pathname: '/who', search: '', hash: '' }), null);
|
|
});
|
|
|
|
test('derives path groups and hidden routes from path or hash', () => {
|
|
assert.equal(getPathSet('/energy'), 'energy');
|
|
assert.equal(getPathSet('/asset'), 'asset');
|
|
assert.equal(getRouteKey('/asset', '#/ele/import'), 'ele/import');
|
|
assert.equal(getRouteKey('/admin/feedback', ''), 'admin/feedback');
|
|
assert.equal(getRouteKey('/who', ''), 'who');
|
|
assert.equal(getRouteKey('/asset', '#mileage'), '');
|
|
});
|