1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Add unit tests for roster_get_display_name

This commit is contained in:
Dustin Lagoy 2021-06-30 18:58:07 -04:00
parent 2b56e33d16
commit e4bf7335d8
3 changed files with 38 additions and 0 deletions

View File

@ -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();
}

View File

@ -30,3 +30,6 @@ void add_contacts_with_different_groups(void** state);
void add_contacts_with_same_groups(void** state);
void add_contacts_with_overlapping_groups(void** state);
void remove_contact_with_remaining_in_group(void** state);
void get_contact_display_name(void** state);
void get_contact_display_name_is_barejid_if_name_is_empty(void** state);
void get_contact_display_name_is_passed_barejid_if_contact_does_not_exist(void** state);

View File

@ -219,6 +219,9 @@ main(int argc, char* argv[])
unit_test(add_contacts_with_same_groups),
unit_test(add_contacts_with_overlapping_groups),
unit_test(remove_contact_with_remaining_in_group),
unit_test(get_contact_display_name),
unit_test(get_contact_display_name_is_barejid_if_name_is_empty),
unit_test(get_contact_display_name_is_passed_barejid_if_contact_does_not_exist),
unit_test_setup_teardown(returns_false_when_chat_session_does_not_exist,
init_chat_sessions,