Files
DashBoard/frontend/tests/portal-shell-wave-a-smoke.test.js
egg f14591c7dc feat(mid-section-defect): full-line bidirectional defect trace center with dual query mode
Transform /mid-section-defect from TMTT-only backward analysis into a full-line
bidirectional defect traceability center supporting all detection stations.

Key changes:
- Parameterized station detection: any workcenter group as detection station
- Bidirectional tracing: backward (upstream attribution) + forward (downstream reject rates)
- Dual query mode: date range OR LOT/工單/WAFER container-based seed resolution
- Multi-select filters for upstream station, equipment model (RESOURCEFAMILYNAME), and loss reasons
- Progressive 3-stage trace pipeline (seed-resolve → lineage → events) with streaming UI
- Equipment model lookup via resource cache instead of SPECNAME
- Session caching, auto-refresh, searchable MultiSelect with fuzzy matching
- Remove legacy tmtt-defect module (fully superseded)
- Archive openspec change artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:16:33 +08:00

87 lines
2.9 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { toRuntimeRoute } from '../src/core/shell-navigation.js';
import { getNativeModuleLoader } from '../src/portal-shell/nativeModuleRegistry.js';
import { buildDynamicNavigationState } from '../src/portal-shell/navigationState.js';
import { getRouteContract } from '../src/portal-shell/routeContracts.js';
const WAVE_A_ROUTES = Object.freeze([
'/wip-overview',
'/wip-detail',
'/hold-overview',
'/hold-detail',
'/hold-history',
'/resource',
'/resource-history',
'/qc-gate',
]);
const WAVE_B_NATIVE_ROUTES = Object.freeze([
'/job-query',
'/excel-query',
'/query-tool',
]);
test('Wave A contracts resolve to native mode with native module loaders', () => {
WAVE_A_ROUTES.forEach((routePath) => {
const contract = getRouteContract(routePath);
assert.ok(contract, `missing contract: ${routePath}`);
assert.equal(contract.renderMode, 'native', `route mode mismatch: ${routePath}`);
assert.equal(typeof getNativeModuleLoader(routePath), 'function', `missing native loader: ${routePath}`);
});
});
test('Wave B contracts resolve to native mode with native module loaders after rewrite', () => {
WAVE_B_NATIVE_ROUTES.forEach((routePath) => {
const contract = getRouteContract(routePath);
assert.ok(contract, `missing contract: ${routePath}`);
assert.equal(contract.renderMode, 'native', `route mode mismatch: ${routePath}`);
assert.equal(typeof getNativeModuleLoader(routePath), 'function', `missing native loader: ${routePath}`);
});
});
test('Wave A routes register as native routes from navigation payload', () => {
const state = buildDynamicNavigationState(
[
{
id: 'reports',
name: 'Reports',
order: 1,
pages: WAVE_A_ROUTES.map((route, index) => ({
route,
name: route,
status: 'released',
order: index + 1,
})),
},
],
{ isAdmin: false },
);
assert.equal(state.dynamicRoutes.length, WAVE_A_ROUTES.length);
assert.deepEqual(state.diagnostics.missingContractRoutes, []);
assert.deepEqual(
state.dynamicRoutes.map((entry) => entry.renderMode),
Array(WAVE_A_ROUTES.length).fill('native'),
);
});
test('Wave A deep links preserve query string in shell runtime paths', () => {
const sampleDeepLinks = [
'/wip-overview?workorder=AA001&status=all',
'/wip-detail?workcenter=WB12&lotid=L01',
'/hold-overview?hold_type=quality&reason=QC',
'/hold-detail?reason=QC&workcenter=WB12',
'/hold-history?start_date=2026-02-01&end_date=2026-02-11&record_type=new,release',
'/resource-history?start_date=2026-02-01&end_date=2026-02-11&granularity=day',
];
sampleDeepLinks.forEach((routePath) => {
assert.equal(
toRuntimeRoute(routePath, { currentPathname: '/portal-shell/wip-overview' }),
`/portal-shell${routePath}`,
);
});
});