Skip to content

Commit 8d48231

Browse files
committed
Remove tests that have been moved to Gitui
1 parent fdcdf9f commit 8d48231

File tree

1 file changed

+0
-97
lines changed

1 file changed

+0
-97
lines changed

Diff for: src/main.rs

-97
Original file line numberDiff line numberDiff line change
@@ -304,100 +304,3 @@ fn set_panic_handlers() -> Result<()> {
304304

305305
Ok(())
306306
}
307-
308-
#[cfg(test)]
309-
mod tests {
310-
use std::{
311-
cell::RefCell, path::PathBuf, thread::sleep, time::Duration,
312-
};
313-
314-
use asyncgit::{sync::RepoPath, AsyncGitNotification};
315-
use crossbeam_channel::unbounded;
316-
use git2_testing::repo_init;
317-
use insta::assert_snapshot;
318-
use ratatui::{backend::TestBackend, Terminal};
319-
320-
use crate::{
321-
app::App, draw, input::Input, keys::KeyConfig,
322-
ui::style::Theme, AsyncNotification,
323-
};
324-
325-
// Macro adapted from: https://insta.rs/docs/cmd/
326-
macro_rules! apply_common_filters {
327-
{} => {
328-
let mut settings = insta::Settings::clone_current();
329-
// MacOS Temp Folder
330-
settings.add_filter(r" *\[…\]\S+?/T/\S+", "[TEMP_FILE]");
331-
// Linux Temp Folder
332-
settings.add_filter(r" */tmp/\.tmp\S+", "[TEMP_FILE]");
333-
// Windows Temp folder
334-
settings.add_filter(r" *\[…\].*/Local/Temp/\S+", "[TEMP_FILE]");
335-
// Commit ids that follow a vertical bar
336-
settings.add_filter(r"│[a-z0-9]{7} ", "│[AAAAA] ");
337-
let _bound = settings.bind_to_scope();
338-
}
339-
}
340-
341-
#[test]
342-
fn app_starts() {
343-
apply_common_filters!();
344-
345-
let (temp_dir, _repo) = repo_init();
346-
let path: RepoPath = temp_dir.path().to_str().unwrap().into();
347-
348-
let (tx_git, _rx_git) = unbounded();
349-
let (tx_app, _rx_app) = unbounded();
350-
351-
let input = Input::new();
352-
353-
let theme = Theme::init(&PathBuf::new());
354-
let key_config = KeyConfig::default();
355-
356-
let mut app = App::new(
357-
RefCell::new(path),
358-
tx_git,
359-
tx_app,
360-
input.clone(),
361-
theme,
362-
key_config.clone(),
363-
)
364-
.unwrap();
365-
366-
let mut terminal =
367-
Terminal::new(TestBackend::new(120, 40)).unwrap();
368-
369-
draw(&mut terminal, &app).unwrap();
370-
371-
assert_snapshot!("app_loading", terminal.backend());
372-
373-
let event =
374-
AsyncNotification::Git(AsyncGitNotification::Status);
375-
app.update_async(event).unwrap();
376-
377-
sleep(Duration::from_millis(500));
378-
379-
draw(&mut terminal, &app).unwrap();
380-
381-
assert_snapshot!("app_loading_finished", terminal.backend());
382-
383-
let event = crossterm::event::KeyEvent::new(
384-
key_config.keys.tab_log.code,
385-
key_config.keys.tab_log.modifiers,
386-
);
387-
app.event(crate::input::InputEvent::Input(
388-
crossterm::event::Event::Key(event),
389-
))
390-
.unwrap();
391-
392-
sleep(Duration::from_millis(500));
393-
394-
app.update().unwrap();
395-
396-
draw(&mut terminal, &app).unwrap();
397-
398-
assert_snapshot!(
399-
"app_log_tab_showing_one_commit",
400-
terminal.backend()
401-
);
402-
}
403-
}

0 commit comments

Comments
 (0)