refactor: integrate get_latest_haiku_or_default into load_haiku

Refs: OPS-65
This commit is contained in:
Christoph J. Scherr 2025-03-23 14:14:27 +01:00
parent cf48ac8164
commit 8f3ccb94d1
No known key found for this signature in database
GPG key ID: 9EB784BB202BB7BB
2 changed files with 7 additions and 13 deletions

View file

@ -37,6 +37,7 @@ def test_save_and_load_haiku(store_manager: StoreManager):
but should have"
assert h == h_loaded
assert h != DEFAULT_HAIKU
def test_load_latest_with_empty_store(temp_data_dir):
@ -47,7 +48,7 @@ def test_load_latest_with_empty_store(temp_data_dir):
def test_load_latest_or_default_with_empty(temp_data_dir):
store = StoreManager(temp_data_dir / "load_or_default_empty.json")
haiku = store.get_latest_haiku_or_default()
haiku = store.load_haiku(store.get_id_of_latest_haiku())
assert haiku == DEFAULT_HAIKU
@ -55,6 +56,6 @@ def test_load_latest_or_default_with_non_empty(temp_data_dir):
store = StoreManager(temp_data_dir / "load_or_default_not_empty.json")
nonsense_test_haiku = Haiku(["nonsense", "test", "haiku"])
store.save_haiku(nonsense_test_haiku)
haiku = store.get_latest_haiku_or_default()
haiku = store.load_haiku(store.get_id_of_latest_haiku())
assert haiku != DEFAULT_HAIKU
assert haiku == nonsense_test_haiku