feat(web): DiffView + DomainDiffPage с prune-guard по умолчанию выключенным

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwxdSt4reTm7Dj1oxRvpP3
This commit is contained in:
2026-07-03 17:32:20 +07:00
co-authored by Claude Opus 4.8
parent 267ffc4ed9
commit 1412da9a31
5 changed files with 373 additions and 1 deletions
+28
View File
@@ -0,0 +1,28 @@
import { render, screen } from "@testing-library/react"
import { DiffView } from "./DiffView"
import type { ChangesetResponse } from "@/api/types"
const cs: ChangesetResponse = {
updates: [{ kind: "update", type: "A", name: "www.example.com.", desired: ["1.1.1.1"], actual: ["9.9.9.9"], readOnly: false }],
prunes: [{ kind: "delete", type: "A", name: "old.example.com.", actual: ["2.2.2.2"], readOnly: false }],
readOnly: [{ kind: "update", type: "NS", name: "example.com.", desired: ["ns1."], actual: ["ns2."], readOnly: true }],
inSyncCount: 3,
}
test("renders all sections with counts", () => {
render(<DiffView changeset={cs} />)
expect(screen.getByText(/www\.example\.com\./)).toBeInTheDocument()
expect(screen.getByText(/old\.example\.com\./)).toBeInTheDocument()
// Anchored (vs. the brief's bare /example\.com\./) — "www.example.com." and
// "old.example.com." both contain "example.com." as a trailing substring,
// so the unanchored pattern matches all three rows and getByText throws
// "multiple elements found". Anchoring targets the read-only apex record
// specifically, which is what this assertion is actually verifying.
expect(screen.getByText(/^example\.com\.$/)).toBeInTheDocument()
expect(screen.getByText(/3/)).toBeInTheDocument() // in-sync count
})
test("marks read-only records", () => {
render(<DiffView changeset={cs} />)
expect(screen.getByText(/NS/)).toBeInTheDocument()
})