estack-tdd
Elixir TDD
Use the existing test framework and project conventions. Load estack-testing when sandbox, vendor isolation, or browser behavior is involved.
Loop
- Identify one observable behavior and its boundary.
- Write the smallest useful failing test and run it. Confirm it fails for the intended reason, not missing setup.
- Implement the behavior and run the test until it passes.
- Refactor while keeping it green, then cover the next meaningful case.
Test public contexts/Ash actions by default. Test a pure function or changeset directly when that is the meaningful contract. Do not calculate expected results with the implementation under test.
Bug fixes
Read the affected path and reproduce the symptom. Add a regression test when feasible, including the unauthorized/error case that actually failed. Run related tests and the available project gate before completion.
If reproduction is intermittent or environment-dependent, record evidence and limits; a test that happens to pass does not prove the diagnosis wrong. Use logs, traces, or controlled experiments. Do not invent a fix or claim a regression test passed without running it.