


























@@ -275,9 +275,11 @@ describe("context notice", () => {
275275expect(lowUsage.warning).toBe(false);
276276expect(lowUsage.compactRecommended).toBe(false);
277277render(renderContextNotice(lowUsageSession, 200_000), container);
278-expect(container.textContent).toContain("23% context used");
279-expect(container.textContent).toContain("46k / 200k");
280-expect(container.querySelectorAll(".context-notice--usage")).toHaveLength(1);
278+const lowNotice = container.querySelector<HTMLElement>(".context-notice--usage");
279+expect(lowNotice?.textContent?.replace(/\s+/gu, " ").trim()).toBe(
280+"23% context used 46k / 200k",
281+);
282+expect(lowNotice?.querySelector(".context-notice__detail")?.textContent).toBe("46k / 200k");
281283expect(container.querySelectorAll(".context-notice__meter")).toHaveLength(1);
282284expect(container.querySelector(".context-notice__icon")).toBeNull();
283285expect(container.textContent).not.toContain("757.3k / 200k");
@@ -292,11 +294,11 @@ describe("context notice", () => {
292294};
293295render(renderContextNotice(session, 200_000), container);
294296295-expect(container.textContent).toContain("95% context used");
296-expect(container.textContent).toContain("190k / 200k");
297297expect(getContextNoticeViewModel(session, 200_000)?.compactRecommended).toBe(true);
298298expect(container.textContent).not.toContain("757.3k / 200k");
299299const notice = container.querySelector<HTMLElement>(".context-notice");
300+expect(notice?.textContent?.replace(/\s+/gu, " ").trim()).toBe("95% context used 190k / 200k");
301+expect(notice?.querySelector(".context-notice__detail")?.textContent).toBe("190k / 200k");
300302expect(notice?.classList.contains("context-notice--warning")).toBe(true);
301303expect(notice?.getAttribute("title")).toBe("Session context usage: 190k / 200k (95%)");
302304expect(notice?.style.getPropertyValue("--ctx-color")).toContain("rgb(");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。