Skip to content

Commit 3dd4a6d

Browse files
lesnik512claude
andauthored
test: lock that the deck list omits cards (#58)
Port the regression test from litestar-sqlalchemy-template#33. The Deck response contract is two-shaped: light `Deck` for list/create/update, `DeckWithCards` for get_deck. No test asserted that `cards` is absent from list responses, so the contract wasn't pinned — the existing tests passed under both the old single-schema design and the split. test_list_decks_omits_cards creates a deck with a card, then asserts the list item has no `cards` key. It would catch a regression that re-added `cards` to the light contract. test_get_one_deck already locks the other half (detail includes cards). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 531565d commit 3dd4a6d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tests/test_decks.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ async def test_get_decks(client: AsyncClient) -> None:
3535
assert v == getattr(deck, k)
3636

3737

38+
async def test_list_decks_omits_cards(client: AsyncClient) -> None:
39+
deck = await factories.DeckModelFactory.create_async()
40+
await factories.CardModelFactory.create_async(deck_id=deck.id)
41+
42+
response = await client.get("/api/decks/")
43+
assert response.status_code == status.HTTP_200_OK
44+
item = response.json()["items"][0]
45+
assert "cards" not in item
46+
47+
3848
async def test_get_one_deck(client: AsyncClient) -> None:
3949
deck = await factories.DeckModelFactory.create_async()
4050
card = await factories.CardModelFactory.create_async(deck_id=deck.id)

0 commit comments

Comments
 (0)