---
id: w1/m15/t007
title: Test coverage — reconcile + surface + UI tests for the new types
worker: worker1
status: done
estimate: 30m
depends_on: [w1/m15/t005]
---

## Objective

Standing test-coverage pass: add reconcile (envtest) coverage for both new types, surface tests for the create-`type`/`schedule` plumbing + cron run trigger, and dashboard tests for the type-aware UI.

## Context

- Operator reconcile is exercised via envtest (`make test` from `lego/operator/` auto-runs codegen + envtest; binaries download to `bin/` on first run). Assert: a worker App produces a Deployment only (no Service/Ingress); a cron App produces a K8s `CronJob` with status run history.
- Backend tests: `cd lego/backend && go test ./...`. Cover `Create` accepting `type`/`schedule`, MCP `create_cron_job`, and the `/cron-jobs/{id}/runs` trigger, across the apps adapters.
- Dashboard tests cover the type badge, the worker "no URL" case, and the cron schedule/runs display in `dashboard/src/features/services`.

## Steps

1. Add operator envtest cases: worker → Deployment-only; cron → CronJob + run-history status.
2. Add backend tests for create-`type`, `schedule`, `create_cron_job`, and the run trigger.
3. Add dashboard tests for the type badge, worker-no-URL, and cron schedule/runs.

## Files

- `lego/operator/internal/controller/*_test.go`
- `lego/backend/internal/apps/*_test.go`
- `dashboard/src/features/services/` (test files)

## Acceptance criteria

- [x] Envtest covers worker (Deployment-only) and cron (CronJob + runs).
- [x] Backend tests cover create-`type`/`schedule`, `create_cron_job`, and the run trigger.
- [x] Dashboard tests cover badge / worker-no-URL / cron schedule+runs; `make test` + dashboard tests green.

## Out of scope

- New feature behavior (that belongs to t001–t004).
- Static-site tests (`w1/012`).
