diff options
author | Dustin Lagoy <dustin@lagoy.org> | 2021-06-30 18:58:07 -0400 |
---|---|---|
committer | Dustin Lagoy <dustin@lagoy.org> | 2021-06-30 18:58:07 -0400 |
commit | e4bf7335d889d82dedf962f2a2590f1a1b7455b6 (patch) | |
tree | 5e5bafd676dc3313fd8ab2aedad999ca5defe81c /tests/unittests/test_roster_list.c | |
parent | 2b56e33d164bfa5ae41b4f598ca3e3ea54dcd51c (diff) | |
download | profani-tty-e4bf7335d889d82dedf962f2a2590f1a1b7455b6.tar.gz |
Add unit tests for roster_get_display_name
Diffstat (limited to 'tests/unittests/test_roster_list.c')
-rw-r--r-- | tests/unittests/test_roster_list.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/unittests/test_roster_list.c b/tests/unittests/test_roster_list.c index b46e7b57..fc10d1a7 100644 --- a/tests/unittests/test_roster_list.c +++ b/tests/unittests/test_roster_list.c @@ -689,3 +689,35 @@ remove_contact_with_remaining_in_group(void** state) g_list_free_full(groups_res, free); roster_destroy(); } + +void +get_contact_display_name(void** state) +{ + roster_create(); + roster_add("person@server.org", "nickname", NULL, NULL, FALSE); + + assert_string_equal("nickname", roster_get_display_name("person@server.org")); + + roster_destroy(); +} + +void +get_contact_display_name_is_barejid_if_name_is_empty(void** state) +{ + roster_create(); + roster_add("person@server.org", NULL, NULL, NULL, FALSE); + + assert_string_equal("person@server.org", roster_get_display_name("person@server.org")); + + roster_destroy(); +} + +void +get_contact_display_name_is_passed_barejid_if_contact_does_not_exist(void** state) +{ + roster_create(); + + assert_string_equal("person@server.org", roster_get_display_name("person@server.org")); + + roster_destroy(); +} |