fix(bulk): node-safe toast (globalThis.window) + common-tags test matches non-empty spec guard

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-16 18:15:23 -04:00
parent 82689e10bc
commit 35e26d6226
2 changed files with 16 additions and 5 deletions
+14 -3
View File
@@ -22,10 +22,11 @@ async def _mk_tag(client, name, kind="general"):
@pytest.mark.asyncio
async def test_common_tags_route(client):
async def test_common_tags_rejects_empty_list(client):
# Spec guard: image_ids must be a non-empty list (the frontend never
# calls this with an empty selection).
resp = await client.post("/api/images/common-tags", json={"image_ids": []})
assert resp.status_code == 200
assert (await resp.get_json())["tags"] == []
assert resp.status_code == 400
@pytest.mark.asyncio
@@ -34,6 +35,16 @@ async def test_common_tags_requires_list(client):
assert resp.status_code == 400
@pytest.mark.asyncio
async def test_common_tags_ok_shape(client):
# Unknown image ids are valid input; result is just an empty tag list.
resp = await client.post(
"/api/images/common-tags", json={"image_ids": [999999]}
)
assert resp.status_code == 200
assert (await resp.get_json())["tags"] == []
@pytest.mark.asyncio
async def test_bulk_add_route_happy(client):
tag = await _mk_tag(client, "RouteAdd")