Skip to content

Commit

Permalink
Return Result in todos test
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Dec 3, 2024
1 parent b2fe05f commit 5dd58c2
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions examples/todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,15 +593,12 @@ mod tests {
use iced::test::selector;

#[test]
fn it_creates_a_new_task() {
fn it_creates_a_new_task() -> Result<(), test::Error> {
let (mut todos, _command) = Todos::new();
let _command = todos.update(Message::Loaded(Err(LoadError::File)));

let mut interface = test::interface(todos.view());

let _input = interface
.click("new-task")
.expect("new-task input must be present");
let _input = interface.click("new-task")?;

interface.typewrite("Create the universe");
interface.press_key(keyboard::key::Named::Enter);
Expand All @@ -611,9 +608,8 @@ mod tests {
}

let mut interface = test::interface(todos.view());
let _ = interface.find(selector::text("Create the universe"))?;

let _ = interface
.find(selector::text("Create the universe"))
.expect("New task must be present");
Ok(())
}
}

0 comments on commit 5dd58c2

Please sign in to comment.