From e45c5a6ef8043c1af45deff8d89f22d84abdcb3f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 15 Dec 2024 17:15:10 +0000 Subject: [PATCH] tests: add test for TrelloBoards::find_by_name() --- src/trello/tests/board/mod.rs | 30 ++++++++++++++++++++++++++++++ src/trello/tests/mod.rs | 5 ++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/trello/tests/board/mod.rs b/src/trello/tests/board/mod.rs index 2563f63..bffc408 100644 --- a/src/trello/tests/board/mod.rs +++ b/src/trello/tests/board/mod.rs @@ -2,3 +2,33 @@ use super::*; mod get; + +#[test] +fn when_board_is_in_list_find_succeeds() { + //given + let board_name: TrelloBoardName = s!("name-1").into(); + let board = TrelloBoard { + id: s!("id-1").into(), + name: board_name.clone(), + lists: vec![], + }; + let boards = vec![ + TrelloBoard { + id: s!("id-2").into(), + name: s!("name-2").into(), + lists: vec![], + }, + board.clone(), + TrelloBoard { + id: s!("id-3").into(), + name: s!("name-3").into(), + lists: vec![], + }, + ]; + + //when + let result = boards.find_by_name(&board_name); + + //then + assert_eq!(result, Some(&board)); +} diff --git a/src/trello/tests/mod.rs b/src/trello/tests/mod.rs index bb87df8..2b2aa09 100644 --- a/src/trello/tests/mod.rs +++ b/src/trello/tests/mod.rs @@ -18,7 +18,10 @@ use crate::{ board::TrelloBoardCommand, card::TrelloCardCommand, member::TrelloMemberCommand, - model::{TrelloBoardId, TrelloCardId}, + model::{ + board::{TrelloBoard, TrelloBoards}, + TrelloBoardId, TrelloBoardName, TrelloCardId, + }, stack::TrelloStackCommand, TrelloCommand, TrelloConfig, },