Archived
全仓测试 route-access.test.ts 钉着一份有意枚举、随 Keycloak spec 审过的名单:哪些读路由被两端共用。 之前把邮件 7 条 GET 标成 design|ops,名单从八条长到十四条。裁决改路由、不改名单:邮箱那一屏落在 运营中心,设计端没有消费方;入站正文装的是客户来往内容,ADR-012 已把「设计端能读客户主数据」记为 一处有意承担的代价,不再无故加宽。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TM4kUBvekALu9qqmp7D3wr
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
/**
|
|
* 邮件路由的归属:15 条全部进契约,注册表建得起来(字面 / 参数模版互不撞),
|
|
* 读写都归运营中心(设计稿 §7.2 + 2026-08-26 裁决:设计端没有消费方,不再无故加宽)。
|
|
*/
|
|
import { describe, expect, it } from 'vitest';
|
|
import * as contracts from '@contracts';
|
|
import { MAIL_ROUTES } from '@contracts';
|
|
import { buildRouteRegistry, routesOf } from '../route-registry.ts';
|
|
|
|
describe('邮件路由契约', () => {
|
|
it('15 条全在契约命名空间里,注册表能建起来', () => {
|
|
const all = routesOf(Object.values(contracts));
|
|
const registry = buildRouteRegistry(all);
|
|
expect(MAIL_ROUTES).toHaveLength(15);
|
|
for (const route of MAIL_ROUTES) {
|
|
expect(registry.has(route.method, route.path)).toBe(true);
|
|
}
|
|
});
|
|
|
|
it('读写都归 ops', () => {
|
|
for (const route of MAIL_ROUTES) {
|
|
expect(route.access).toBe('ops');
|
|
}
|
|
});
|
|
|
|
it('未存草稿探测与已存账号探测是两条不同的路', () => {
|
|
const registry = buildRouteRegistry(routesOf(Object.values(contracts)));
|
|
expect(registry.lookup('POST', '/api/gov/mail/accounts/probe')).toBe('ops');
|
|
expect(registry.lookup('POST', '/api/gov/mail/accounts/acc-1/probe')).toBe('ops');
|
|
expect(registry.lookup('GET', '/api/gov/mail/inbound/m-1/attachments/0')).toBe('ops');
|
|
});
|
|
});
|