| 123456789101112131415161718192021222324252627282930 |
- import assert from 'node:assert/strict'
- import { toNestedRoutePath } from '../src/router/nestedRouteUtils.js'
- const rootPath = '/subSystem/pipeNetwork'
- assert.equal(
- toNestedRoutePath('/subSystem/pipeNetwork/pdeviceInform/netWorkBase', rootPath),
- 'pdeviceInform/netWorkBase',
- 'canonical absolute paths must become relative to the subsystem root'
- )
- assert.equal(
- toNestedRoutePath('/pipeNetwork/pdeviceInform/netWorkBase', rootPath),
- 'pdeviceInform/netWorkBase',
- 'legacy pipeNetwork prefixes must not be duplicated below the new subsystem root'
- )
- assert.equal(
- toNestedRoutePath('/pdeviceInform/netWorkBase', rootPath),
- 'pdeviceInform/netWorkBase',
- 'already-relative menu paths must remain unchanged'
- )
- assert.equal(
- toNestedRoutePath('/assetInfo/pdeviceInform/netWorkBase', rootPath),
- 'assetInfo/pdeviceInform/netWorkBase',
- 'unrelated directory segments must remain intact'
- )
- console.log('nestedRouteUtils tests passed')
|