This repository has been archived on 2026-09-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BPOS-TMP-REPO/apps/api/src/app/__tests__/activity-routes-registry.test.ts
T
xcsandClaude Fable 5 0923fbfe4d feat(ops): 运营中心 · 活动模块接口落地 —— L1/L2/L3 十一条(全 ops)+ 设计端活动库两条改名让位
`apps/api/src/app/activity-ops/*`(service / store / instance-state / instance-steps / launch-params /
summaries / view-html / view-scope)+ `routes/activities.ts`;契约 `activity-ops.ts` / `api/activity-ops.ts`
(与队友按文档补的那版 43 个导出同名,多 INSTANCE_REASON_KINDS / STEP_RESULTS / launchOptionSchema);
迁移 0035_activity_ops;《API文档-活动模块》按契约回写。
设计端活动库 GET/POST `/api/gov/activities` 改名 `/api/gov/activity-packages`,`/api/gov/activities/*`
整个让给运营端(前端 import 路由对象,零改动);activity-registry CONTRACT.md 与路由总表同步。
2026-08-27 另一会话做的,一直留在工作树没入库;与同批另两条提交互相依赖,以合并提交为验证单位。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0167qWjeyBwvfdGovd7FWbCu
2026-08-27 23:20:15 +08:00

27 lines
1.5 KiB
TypeScript

/**
* 活动模块路由的归属:11 条全部进契约、注册表建得起来(与设计端的 activity-packages 互不撞),全归运营中心。
*/
import { describe, expect, it } from 'vitest';
import * as contracts from '@contracts';
import { ACTIVITY_OPS_ROUTES } from '@contracts';
import { buildRouteRegistry, routesOf } from '../route-registry.ts';
describe('活动模块路由契约', () => {
it('11 条全在契约命名空间里,注册表能建起来', () => {
const registry = buildRouteRegistry(routesOf(Object.values(contracts)));
expect(ACTIVITY_OPS_ROUTES).toHaveLength(11);
for (const route of ACTIVITY_OPS_ROUTES) expect(registry.has(route.method, route.path), route.path).toBe(true);
});
it('全归 ops;设计端活动库让位到 activity-packages 后仍归 design', () => {
const registry = buildRouteRegistry(routesOf(Object.values(contracts)));
for (const route of ACTIVITY_OPS_ROUTES) expect(route.access).toBe('ops');
expect(registry.lookup('GET', '/api/gov/activities')).toBe('ops');
expect(registry.lookup('GET', '/api/gov/activity-packages')).toBe('design');
expect(registry.lookup('POST', '/api/gov/activity-packages')).toBe('design');
expect(registry.lookup('GET', '/api/gov/activities/part-substitution-assessment/view')).toBe('ops');
expect(registry.lookup('POST', '/api/gov/activities/part-substitution-assessment/instances/t-1/terminate')).toBe('ops');
expect(registry.lookup('GET', '/api/gov/activities/x/instances/t-1/files/output/0')).toBe('ops');
});
});