def test_map_list_collector_config_no_actions(): list_items = [{"item_title": "Mark Bloggs"}, {"item_title": "Joe Bloggs"}] output = map_list_collector_config(list_items, "icon") expected = [ { "rowItems": [{ "actions": [], "icon": "icon", "rowTitle": "Mark Bloggs", "rowTitleAttributes": { "data-qa": "list-item-1-label" }, }] }, { "rowItems": [{ "actions": [], "icon": "icon", "rowTitle": "Joe Bloggs", "rowTitleAttributes": { "data-qa": "list-item-2-label" }, }] }, ] assert output == expected
def test_map_list_collector_config_no_actions(): list_items = [{"item_title": "Mark Bloggs"}, {"item_title": "Joe Bloggs"}] output = map_list_collector_config(list_items, "icon") expected = [ { "rowItems": [{ "actions": [], "icon": "icon" }], "rowTitle": "Mark Bloggs" }, { "rowItems": [{ "actions": [], "icon": "icon" }], "rowTitle": "Joe Bloggs" }, ] assert output == expected
def test_map_list_collector_config(): list_items = [ { "remove_link": "/primary/remove", "edit_link": "/primary/change", "primary_person": True, "item_title": "Mark Bloggs (You)", "id": "primary", "list_item_id": "primary", }, { "remove_link": "/nonprimary/remove", "edit_link": "/nonprimary/change", "primary_person": False, "item_title": "Joe Bloggs", "id": "nonprimary", "list_item_id": "nonprimary", }, ] output = map_list_collector_config( list_items, "icon", "edit_link_text", "edit_link_aria_label", "remove_link_text", "remove_link_aria_label", ) expected = [ { "rowItems": [ { "actions": [ { "ariaLabel": "edit_link_aria_label", "attributes": {"data-qa": "list-item-change-1-link"}, "text": "edit_link_text", "url": "/primary/change", } ], "iconType": "icon", "rowTitle": "Mark Bloggs (You)", "id": "primary", "rowTitleAttributes": { "data-qa": "list-item-1-label", "data-list-item-id": "primary", }, } ] }, { "rowItems": [ { "actions": [ { "ariaLabel": "edit_link_aria_label", "attributes": {"data-qa": "list-item-change-2-link"}, "text": "edit_link_text", "url": "/nonprimary/change", }, { "ariaLabel": "remove_link_aria_label", "attributes": {"data-qa": "list-item-remove-2-link"}, "text": "remove_link_text", "url": "/nonprimary/remove", }, ], "iconType": "icon", "rowTitle": "Joe Bloggs", "id": "nonprimary", "rowTitleAttributes": { "data-qa": "list-item-2-label", "data-list-item-id": "nonprimary", }, } ] }, ] assert output == expected