Compare commits

...

1 Commits

Author SHA1 Message Date
Jiang Bohan
16e72931d4 test(issues): match new metadata trigger label with count suffix
The sidebar metadata trigger now reads "Metadata · N" (#3010), so the
exact-name button query stopped matching and 2 tests went red on main.
Relax the assertion to `/^Metadata\b/` — still anchors on the label but
tolerates the count suffix.
2026-05-21 18:24:47 +08:00

View File

@@ -681,7 +681,9 @@ describe("IssueDetail (shared)", () => {
renderIssueDetail();
await waitFor(() => {
expect(screen.getByRole("button", { name: "Metadata" })).toBeInTheDocument();
// Trigger label includes a "· N" count so users can see payload size
// before clicking — accept any count via regex.
expect(screen.getByRole("button", { name: /^Metadata\b/ })).toBeInTheDocument();
});
// Key names are not rendered in the sidebar prior to opening the dialog.
@@ -700,7 +702,7 @@ describe("IssueDetail (shared)", () => {
renderIssueDetail();
const button = await screen.findByRole("button", { name: "Metadata" });
const button = await screen.findByRole("button", { name: /^Metadata\b/ });
fireEvent.click(button);
// The dialog renders a <pre> containing the formatted JSON; checking the
@@ -725,7 +727,7 @@ describe("IssueDetail (shared)", () => {
expect(screen.getByText("Details")).toBeInTheDocument();
});
expect(screen.queryByRole("button", { name: "Metadata" })).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: /^Metadata\b/ })).not.toBeInTheDocument();
});
it("renders Details section with Created by and dates", async () => {