fix(web): reveal NFC peripherals after detection
This commit is contained in:
@@ -143,6 +143,7 @@ def test_each_detection_publishes_three_frames_per_device_and_then_stops() -> No
|
||||
|
||||
nfc["card"] = None
|
||||
assert wait_until(lambda: service.snapshot()["state"] == "waiting_for_nfc")
|
||||
assert service.snapshot()["detected_nfc_ids"] == ["E113B203"]
|
||||
nfc["card"] = {"action": "present", "uid": "E113B203"}
|
||||
assert wait_until(lambda: len(publications) == 12)
|
||||
assert service.snapshot()["state"] == "burst_complete"
|
||||
@@ -150,6 +151,29 @@ def test_each_detection_publishes_three_frames_per_device_and_then_stops() -> No
|
||||
service.close()
|
||||
|
||||
|
||||
def test_detected_devices_remain_latched_until_publisher_stops() -> None:
|
||||
nfc: dict[str, Any] = {"card": {"action": "present", "uid": "E113B203"}}
|
||||
service = NfcExtensionToyPublisher(
|
||||
nfc_provider=lambda: nfc,
|
||||
catalog_provider=lambda: [capability("light-on")],
|
||||
publisher=lambda _payload: {"delivery_status": "queued"},
|
||||
burst_window_s=0.03,
|
||||
poll_interval_s=0.005,
|
||||
)
|
||||
service.start()
|
||||
try:
|
||||
assert wait_until(
|
||||
lambda: service.snapshot()["detected_nfc_ids"] == ["E113B203"]
|
||||
)
|
||||
nfc["card"] = None
|
||||
assert wait_until(lambda: service.snapshot()["state"] == "waiting_for_nfc")
|
||||
assert service.snapshot()["detected_nfc_ids"] == ["E113B203"]
|
||||
finally:
|
||||
service.close()
|
||||
|
||||
assert service.snapshot()["detected_nfc_ids"] == []
|
||||
|
||||
|
||||
def test_no_matching_ability_publishes_nothing() -> None:
|
||||
nfc = {"card": {"action": "present", "uid": "E113B203"}}
|
||||
publications: list[dict[str, Any]] = []
|
||||
@@ -168,6 +192,7 @@ def test_no_matching_ability_publishes_nothing() -> None:
|
||||
assert wait_until(
|
||||
lambda: service.snapshot()["state"] == "no_matching_extension"
|
||||
)
|
||||
assert service.snapshot()["detected_nfc_ids"] == ["E113B203"]
|
||||
time.sleep(0.05)
|
||||
assert publications == []
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user