---
id: w1/m11.5/t007
title: Test coverage — meaningful tests for the custom-domains UI
worker: worker1
status: done
estimate: 30m
depends_on: [w1/m11.5/t005]
---

## Objective

Add meaningful Vitest + React Testing Library tests for the custom-domains
components, covering the real behavior and failure modes shipped by this milestone.

## Context

- Tests live in `__tests__/` adjacent to the component file; follow the pattern in
  `src/features/services/__tests__/`.
- Mock Apollo operations with `MockedProvider` (pattern used in existing service
  tests).
- Locale strings: wrap tests in an i18n provider or mock `useTranslations`.

## Steps

1. `custom-domains-section.test.tsx`:
   - Renders the empty state when `customDomains` returns `[]`.
   - Renders rows with correct Name link, Verified Status badge, Certificate Status
     badge when domains are returned.
   - "Add Custom Domain" button opens the dialog.
   - Submitting a valid FQDN calls the `addCustomDomain` mutation.
   - Empty FQDN disables the submit button.
   - Delete kebab → confirm → calls `deleteCustomDomain` mutation.
   - Apollo error surfaces as a toast (not a crash).
2. `platform-subdomain-section.test.tsx`:
   - Shows the service URL as an external link.

## Files

- `dashboard/src/features/services/components/__tests__/custom-domains-section.test.tsx`
  (new)
- `dashboard/src/features/services/components/__tests__/platform-subdomain-section.test.tsx`
  (new)

## Acceptance criteria

- [ ] `yarn test` passes with the new tests.
- [ ] Test cases cover: empty state, populated list, add mutation, delete mutation,
      empty-FQDN guard, and API error handling.

## Out of scope

- E2E / Playwright tests. Tests for DNS instructions (not yet built).
