finish recording test
[?]
May 22, 2025, 7:16 PM
X6AK4QPXKTGTWIMJ5CIR46CVIXVUXV5WKTP73CNQOIRANQN4MD5QCDependencies
Change contents
- replacement in inflorescence/src/test.rs at line 5
cursor, edit_record_msg, init, save_record, start_record, task, update,Msg, State,abandon_record, cursor, defer_record, edit_record_msg, init, save_record,start_record, task, update, Msg, State, - edit in inflorescence/src/test.rs at line 145
dbg!(&state.repo.as_ref().unwrap().log); - replacement in inflorescence/src/test.rs at line 151
// Case: start -> edit -> abandon -> start// Case: start -> edit -> abandon// Add an untracked filelet file_to_record = "soul.rs";fs::write(repo_path.join(file_to_record), "music").await.unwrap();// Wait for the FS watch to pick it uplet msg = await_next_msg(&mut fs_watch_task).await;assert_matches!(&msg,Msg::View(app::Msg::ToRepo(repo::MsgIn::RefreshChangedAndUntrackedFiles)));// Update the state with it to send it to repolet _task = update(&mut state, msg);// Wait for response from repolet msg = await_next_msg(&mut tasks).await;assert_matches!(&msg, Msg::FromRepo(repo::MsgOut::Refreshed(_)));let _task = update(&mut state, msg);// Select itstate.cursor.selection = Some(cursor::Selection::UntrackedFile {ix: 0,path: file_to_record.to_string(),});// Add it to tracked fileslet _task = update(&mut state, Msg::AddUntrackedFile);// Wait for it to be addedlet msg = task::await_next_msg(&mut tasks).await;assert_matches!(&msg,Msg::FromRepo(repo::MsgOut::AddedUntrackedFile { path }) if path == file_to_record);// Start a recordlet _task = start_record(&mut state);assert!(state.record_msg.is_some());// Edit the record msglet record_msg = "Added soul music";edit_record_msg(&mut state,text_editor::Action::Edit(text_editor::Edit::Paste(Arc::new(record_msg.to_string(),))),);assert!(state.record_msg.is_some());assert_matches!(state.record_msg.as_ref().unwrap(),app::RecordMsg::Typing(_));if let app::RecordMsg::Typing(content) = state.record_msg.as_ref().unwrap(){assert_eq!(&content.text(), record_msg);} - edit in inflorescence/src/test.rs at line 211
// Abandon itabandon_record(&mut state);assert!(state.record_msg.is_none()); - edit in inflorescence/src/test.rs at line 217
// Start a record - there's an an added file from previous caselet _task = start_record(&mut state);assert!(state.record_msg.is_some());// Edit the record msglet record_msg = "Added soul music";edit_record_msg(&mut state,text_editor::Action::Edit(text_editor::Edit::Paste(Arc::new(record_msg.to_string(),))),);assert!(state.record_msg.is_some());assert_matches!(state.record_msg.as_ref().unwrap(),app::RecordMsg::Typing(_));if let app::RecordMsg::Typing(content) = state.record_msg.as_ref().unwrap(){assert_eq!(&content.text(), record_msg);}// Defer the recorddefer_record(&mut state);assert!(state.record_msg.is_some());assert_matches!(state.record_msg.as_ref().unwrap(),app::RecordMsg::Canceled { old_msg } if old_msg == record_msg);// Start again// Start a record - there's an an added file from previous caselet _task = start_record(&mut state);assert!(state.record_msg.is_some());assert!(state.record_msg.is_some());assert_matches!(state.record_msg.as_ref().unwrap(),app::RecordMsg::Typing(msg) if &msg.text() == record_msg);