Skip to content

Commit 3f7ec86

Browse files
committed
test(config): cover both fallback family slots
The key rename exercised preview persistence only through fallback 1, so the fallback 2 mapping could drift without a failure. Save, replace, and clear both slots through the server path. The guard was mutation-tested by mapping both UI fields to fallback_1: the focused test failed, then passed after restoring the production mapping.
1 parent a13bc6e commit 3f7ec86

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

tests/test_preview_server.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,18 +1886,24 @@ def test_the_second_family_a_config_builds_takes_its_name_too(scratch):
18861886
assert "Ledger" in response.text
18871887

18881888

1889-
def test_a_fallback_family_is_stored_as_its_regular_file(scratch):
1890-
"""The converter takes a file; the panel offers families, because that is
1891-
the only sane way to pick one. The trip in has to land on the face."""
1889+
def test_each_fallback_family_slot_is_stored_as_its_regular_file(scratch):
1890+
"""The converter takes a file; the panel offers families, so each trip
1891+
through the save path has to land on that family's regular face."""
18921892
response = _save_export("Alto", fallback1="Ledger")
18931893
assert response.status_code == 200, response.text
1894-
assert "fallback_1 = Ledger.ttf" in \
1895-
(_conf(scratch) / "alto.conf").read_text(encoding="utf-8")
1894+
conf = _conf(scratch) / "alto.conf"
1895+
assert "fallback_1 = Ledger.ttf" in conf.read_text(encoding="utf-8")
18961896

1897-
_save_export("Alto", fallback1="")
1898-
assert "fallback_1" not in \
1899-
(_conf(scratch) / "alto.conf").read_text(encoding="utf-8"), \
1900-
"clearing the picker left the file behind"
1897+
response = _save_export("Alto", fallback1="", fallback2="Ledger")
1898+
assert response.status_code == 200, response.text
1899+
text = conf.read_text(encoding="utf-8")
1900+
assert "fallback_1" not in text, \
1901+
"clearing the first picker left its family behind"
1902+
assert "fallback_2 = Ledger.ttf" in text
1903+
1904+
_save_export("Alto", fallback2="")
1905+
assert "fallback_2" not in conf.read_text(encoding="utf-8"), \
1906+
"clearing the second picker left its family behind"
19011907

19021908

19031909
def test_sizes_the_device_could_not_read_are_refused(scratch):

0 commit comments

Comments
 (0)