





















@@ -31,3 +31,52 @@ describe("pickTagline", () => {
3131).toBe("Your terminal just grew claws\u2014type something and let the bot pinch the busywork.");
3232});
3333});
34+35+describe("future holiday tagline windows (2028-2030)", () => {
36+// Regression coverage for the 2028-2030 floating-holiday rows. Before those
37+// rows existed, the holiday rule returned false for these dates and the
38+// tagline was silently filtered out of the active pool. activeTaglines is no
39+// longer exported, so we sample the public pickTagline() across every pool
40+// index (by sweeping the injected random()) to recover the full active pool
41+// for a given date, then assert the matching holiday tagline is present.
42+// UTC dates are used because the holiday rules compare in UTC.
43+const activePoolOn = (year: number, monthIndex: number, day: number): string[] => {
44+const now = () => new Date(Date.UTC(year, monthIndex, day, 12, 0, 0));
45+const seen = new Set<string>();
46+for (let i = 0; i < 200; i++) {
47+const r = i / 200;
48+seen.add(pickTagline({ mode: "random", now, random: () => r }));
49+}
50+return [...seen];
51+};
52+const poolHas = (pool: string[], term: string) =>
53+pool.some((t) => t.toLowerCase().includes(term));
54+55+it("activates the Lunar New Year tagline on 2028-01-26", () => {
56+expect(poolHas(activePoolOn(2028, 0, 26), "lunar new year")).toBe(true);
57+});
58+59+it("activates the Diwali tagline on 2029-11-05", () => {
60+expect(poolHas(activePoolOn(2029, 10, 5), "diwali")).toBe(true);
61+});
62+63+it("activates the Diwali tagline on 2030-10-25", () => {
64+expect(poolHas(activePoolOn(2030, 9, 25), "diwali")).toBe(true);
65+});
66+67+it("activates the Easter tagline on 2030-04-21", () => {
68+expect(poolHas(activePoolOn(2030, 3, 21), "easter")).toBe(true);
69+});
70+71+it("activates the Hanukkah tagline across its full 2028 window (Dec 13 and Dec 20)", () => {
72+expect(poolHas(activePoolOn(2028, 11, 13), "hanukkah")).toBe(true);
73+expect(poolHas(activePoolOn(2028, 11, 20), "hanukkah")).toBe(true);
74+});
75+76+it("does not activate floating holiday taglines on a plain date (2028-07-15)", () => {
77+const pool = activePoolOn(2028, 6, 15);
78+for (const term of ["lunar new year", "diwali", "easter", "hanukkah", "eid al-fitr"]) {
79+expect(poolHas(pool, term)).toBe(false);
80+}
81+});
82+});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。