mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): scope TemplateSettingsPage validation error assertion to form (#22308)
The sonner migration (https://github.com/coder/coder/pull/22258) shows validation errors in both the inline form field and a toast. Scoping the assertion to the form element avoids flaky matches against the toast. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -8,7 +8,7 @@ import {
|
||||
waitForLoaderToBeRemoved,
|
||||
} from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
import { screen, waitFor } from "@testing-library/react";
|
||||
import { screen, waitFor, within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { API, withDefaultFeatures } from "api/api";
|
||||
import type { UpdateTemplateMeta } from "api/typesGenerated";
|
||||
@@ -131,8 +131,11 @@ describe("TemplateSettingsPage", () => {
|
||||
);
|
||||
await fillAndSubmitForm(validFormValues);
|
||||
await waitFor(() => expect(API.updateTemplateMeta).toBeCalledTimes(1));
|
||||
const form = await screen.findByRole("form", {
|
||||
name: /template settings/i,
|
||||
});
|
||||
expect(
|
||||
await screen.findByText(
|
||||
await within(form).findByText(
|
||||
"This value is already in use and should be unique.",
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user