Merge pull request #2863 from Molecule-AI/fix/expand-removal-followup

fix(canvas/tests): pin Expand-to-Team absence with literal assertion
This commit is contained in:
Hongming Wang 2026-05-05 10:07:53 +00:00 committed by GitHub
commit 9e678ccd5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -240,7 +240,11 @@ describe("ContextMenu — keyboard accessibility", () => {
render(<ContextMenu />);
const items = screen.getAllByRole("menuitem");
const labels = items.map((el) => el.textContent?.trim() ?? "");
expect(labels).not.toContain(expect.stringMatching(/Expand to Team/));
// Literal absence — vitest's toContain uses Object.is/===, so the
// earlier `.not.toContain(expect.stringMatching(...))` shape passed
// for ANY string array (asymmetric matchers only work with toEqual /
// arrayContaining). Pin the production string verbatim.
expect(labels.some((l) => l.includes("Expand to Team"))).toBe(false);
// Sanity: childless menu still has the regular actions.
expect(labels.some((l) => l.includes("Delete"))).toBe(true);
expect(labels.some((l) => l.includes("Restart"))).toBe(true);