Skip to content

Commit ca19275

Browse files
committed
test(ui): pin ViewSwitcher barrel export
1 parent afd3543 commit ca19275

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎app/src/ui/primitives/style-contract.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,20 @@ describe("批 5(C14①)ViewSwitcher:类名枚举 ↔ CSS 规则 · 零行
271271
expect(clean.match(/style=\{/g) ?? [], "ViewSwitcher.tsx 出现行内 style(视觉权威必须留在类里)").toHaveLength(0);
272272
expect(src, '缺 `import "./ViewSwitcher.css";` —— 类名照旧产出、样式静默失效').toContain('import "./ViewSwitcher.css";');
273273
});
274+
275+
it("③ barrel(ADR-033 §1 的唯一公共入口):组件 + 两个类型都在 `index.ts` 的导出语句里", () => {
276+
const barrel = read("index.ts");
277+
// 三条正则各自只认**那条** `export … from "./ViewSwitcher"` 语句(不是文件里随便出现一次)
278+
expect(barrel, "`ViewSwitcher` 未从 barrel 导出(§1:调用点不得深导入 —— 深导入还不带 motion.css)").toMatch(
279+
/export \{ ViewSwitcher \} from "\.\/ViewSwitcher";/,
280+
);
281+
for (const name of ["ViewSwitcherOption", "ViewSwitcherProps"]) {
282+
expect(barrel, `\`${name}\` 未从 barrel 导出(漏导出 = 批 5 接线时才炸,今天还没有消费者)`).toMatch(
283+
new RegExp(`export type \\{[^}]*\\b${name}\\b[^}]*\\} from "\\./ViewSwitcher";`),
284+
);
285+
}
286+
// 阳性对照:同一批正则喂一条**不含** ViewSwitcher 的合成导出必须不命中 ⇒ 上面三条不是恒真
287+
const synthetic = 'export { Text } from "./Text";';
288+
expect(synthetic, "正则在错误样本上也命中 ⇒ 上面的断言空真").not.toMatch(/from "\.\/ViewSwitcher";/);
289+
});
274290
});

0 commit comments

Comments
 (0)