Reviewing tests written by an Angular coding agent

← Back to Blog & Articles

Models write tests that have the shape of tests.

The common faults are consistent enough to list, and each is a review question.

Tests that pass for any implementation. A test that renders a component and asserts that the output is defined, or that the element exists, passes on a broken component. The remedy is to require exact expected values in the brief: “asserts that the heading text is the string given”.

Tests that mirror the implementation. A test that recomputes the expected value with the same expression the code uses cannot disagree with the code. If the code computes a price with a formula, the test should contain a literal number worked out by hand.

Tests that check one example. A single input checks one path. A function with a branch needs one test per branch, and the useful extra case is the boundary: the minimum length and one fewer, the empty list, the item that matches only in the summary.

Tests that exercise only the first render. The error from the companion book: a component whose output should change when an input changes, tested with one input value. The test passes with the broken field initializer and with the correct computed signal alike.

Tests that depend on timing. A test that waits a fixed time for something to happen is slow when generous and flaky when tight. The framework’s test helpers wait for stability, and the contact form’s test needed one extra turn of the event loop for the promise returned by a submit handler to resolve. That was found by running the test, which failed on its first attempt, and is exactly the kind of detail an agent resolves by reading the failure and adjusting.

Tests that are changed to pass. The subject of the failure study below.

Put the first five in the brief’s acceptance criteria as literal requirements, and the last in the instruction file as a prohibition.

Continue with the book

Explore the full treatment, worked examples, and exercises in Local AI Agents for Angular Teams.


Companion article for Local AI Agents for Angular Teams, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.

Scroll to Top