fix(web): DomainsPage показывает ошибки привязки шаблона и удаления

This commit is contained in:
2026-07-03 17:49:48 +07:00
parent 0ce15d30a8
commit ef003230fa
2 changed files with 24 additions and 0 deletions
+13
View File
@@ -80,6 +80,19 @@ test("привязка шаблона в строке домена вызыва
await waitFor(() => expect(setTemplateSpy).toHaveBeenCalledWith("d1", "t1"))
})
test("ошибка привязки шаблона отображается пользователю", async () => {
vi.spyOn(api, "setDomainTemplate").mockRejectedValue(new Error("Не удалось привязать шаблон"))
const user = userEvent.setup()
renderPage()
await screen.findByText("example.com.")
await user.click(screen.getByRole("combobox", { name: /example\.com\./i }))
await user.click(await screen.findByRole("option", { name: /^standard$/i }))
expect(await screen.findByRole("alert")).toHaveTextContent("Не удалось привязать шаблон")
})
test("пустое состояние при отсутствии доменов", async () => {
vi.spyOn(api, "listDomains").mockResolvedValue([])
renderPage()