---
id: w4/m12/t007
title: Test coverage — meaningful tests for membership behavior
worker: worker4
status: done
estimate: 30m
depends_on: [w4/m12/t008]
---

## Objective

Add meaningful tests for what m12 shipped: row+tuple atomicity (including the crash-between-writes reconciliation), last-admin guards, invite token lifecycle (expiry, single-use, wrong-email), authorization on the verbs themselves, and Team-page states per `dashboard/CLAUDE.md` conventions. Assert real behavior and failure modes — never trivial or tautological tests.

## Context

- Standing closing task; extend the store test patterns (w1/m2) and the dashboard test conventions (w4/m8 t004).

## Steps

1. Verb unit tests: atomic writes, guards, typed errors, 403 matrix.
2. Invite lifecycle tests: expiry clock, reuse refusal, email mismatch.
3. Dashboard tests: admin vs viewer control rendering, error-state surfacing.

## Files

- `lego/backend/internal/**/*_test.go`
- `dashboard/src/**/*.test.*`

## Acceptance criteria

- [ ] Every t001–t004 acceptance criterion has a regression test; backend + dashboard suites green.

## Out of scope

- Coverage-percentage gaming; duplicate e2e beyond t005.
