Skip to content

Commit 6796584

Browse files
lesnik512claude
andcommitted
test: lock that the deck list omits cards
PR #30 split the Deck response contract (light Deck for lists, DeckWithCards for detail) but no test asserted that cards is absent from list responses — the existing tests passed either way. Add a test that creates a deck WITH a card and asserts the list item has no cards key. Under the old single-schema design this would have failed (it returned the misleading cards: []), so it pins the fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 52f0256 commit 6796584

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_codes.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)