feat: add AniList browsing with on-demand ZokoAnime playback
This commit is contained in:
+19
-15
@@ -27,32 +27,36 @@ fn startup_provider_selection_preserves_query_and_handles_boundaries_and_cancel(
|
||||
provider_selection(&mut selected, Some(Action::SelectorPrevious)),
|
||||
Continue(())
|
||||
);
|
||||
for (action, miruro) in [(Action::SelectorOpen, false), (Action::SelectorNext, true)] {
|
||||
if action == Action::SelectorNext {
|
||||
assert_eq!(
|
||||
provider_selection(&mut selected, Some(action)),
|
||||
Continue(())
|
||||
);
|
||||
assert_eq!(
|
||||
provider_selection(&mut selected, Some(action)),
|
||||
Continue(())
|
||||
);
|
||||
}
|
||||
for (index, provider) in [
|
||||
BrowseProvider::YouTube,
|
||||
BrowseProvider::AniList,
|
||||
BrowseProvider::Miruro,
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
{
|
||||
selected = index;
|
||||
let Break(Some(choice)) = provider_selection(&mut selected, Some(Action::SelectorOpen))
|
||||
else {
|
||||
panic!("Selected provider must open");
|
||||
};
|
||||
assert_eq!(choice, miruro);
|
||||
assert_eq!(choice, provider);
|
||||
let mut options = Options::parse_from(["tubular", "initial query"]);
|
||||
options.miruro = choice;
|
||||
options.miruro = choice == BrowseProvider::Miruro;
|
||||
options.anilist = choice == BrowseProvider::AniList;
|
||||
assert_eq!(options.query.as_deref(), Some("initial query"));
|
||||
assert_eq!(options.miruro, miruro);
|
||||
if !miruro {
|
||||
if choice == BrowseProvider::YouTube {
|
||||
let app = App::new(options, PathBuf::new(), config::Config::default());
|
||||
assert_eq!(app.views[0].query, "initial query");
|
||||
assert_eq!(app.views[app.view_index].source, ViewSource::Search);
|
||||
}
|
||||
}
|
||||
assert_eq!(
|
||||
provider_selection(&mut selected, Some(Action::SelectorNext)),
|
||||
Continue(())
|
||||
);
|
||||
assert_eq!(selected, PROVIDERS.len() - 1);
|
||||
assert!(Options::try_parse_from(["tubular", "--miruro", "--anilist"]).is_err());
|
||||
for action in [Action::SelectorClose, Action::Quit, Action::Interrupt] {
|
||||
assert_eq!(provider_selection(&mut selected, Some(action)), Break(None));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user