Files
streamline/control-web/test/ideasPublishGate.test.ts
2026-11-16 17:26:44 -08:00

21 lines
1.1 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import { canPublishToIdeas } from "../src/lib/ideas";
/** 抽屉右下「发布到 Ideas」角标只在 Feature 类别出现:Bug 是缺陷单,不是想法。 */
describe("canPublishToIdeas:谁能在详情页把单子发布到 Ideas", () => {
test("Feature + 已登录 → 显示", () => {
expect(canPublishToIdeas("feature", "someone@bytedance.com")).toBe(true);
});
test("其余四类(含 Bug)一律不显示", () => {
expect(canPublishToIdeas("bug", "someone@bytedance.com")).toBe(false);
expect(canPublishToIdeas("security", "someone@bytedance.com")).toBe(false);
expect(canPublishToIdeas("prototype", "someone@bytedance.com")).toBe(false);
expect(canPublishToIdeas("verify", "someone@bytedance.com")).toBe(false);
});
test("没登录(抽屉还没拿到 myEmail)不显示", () => {
expect(canPublishToIdeas("feature", "")).toBe(false);
expect(canPublishToIdeas(null, "someone@bytedance.com")).toBe(false);
expect(canPublishToIdeas(undefined, "someone@bytedance.com")).toBe(false);
});
});