From 243b871bd98e84706436f40ca25c74033629dda0 Mon Sep 17 00:00:00 2001 From: osoken Date: Sun, 24 Mar 2024 21:29:49 +0900 Subject: [PATCH] test(storage): add test for get_posts_by_ids empty case --- tests/test_storage.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/test_storage.py b/tests/test_storage.py index 223fb94..383f6d0 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -2,7 +2,7 @@ from sqlalchemy.engine import Engine -from birdxplorer.models import Post, Topic +from birdxplorer.models import Post, PostId, Topic from birdxplorer.storage import NoteRecord, PostRecord, Storage, TopicRecord @@ -43,3 +43,17 @@ def test_get_posts_by_ids( expected = [post_samples[i] for i in (0, 2)] actual = list(storage.get_posts_by_ids(post_ids)) assert expected == actual + + +def test_get_posts_by_ids_empty( + engine_for_test: Engine, + post_samples: List[Post], + post_records_sample: List[PostRecord], + topic_records_sample: List[TopicRecord], + note_records_sample: List[NoteRecord], +) -> None: + storage = Storage(engine=engine_for_test) + post_ids: List[PostId] = [] + expected: List[Post] = [] + actual = list(storage.get_posts_by_ids(post_ids)) + assert expected == actual