Further isolate
All checks were successful
Cargo CI / Lint (pull_request) Successful in 43s
Cargo CI / Build and Test (pull_request) Successful in 1m4s

This commit is contained in:
Wojciech Kozlowski 2024-01-21 19:20:44 +01:00
parent 9d4682b8bc
commit 4887456650
10 changed files with 21 additions and 12 deletions

View File

@ -66,7 +66,7 @@ mod tests {
use mockall::predicate;
use crate::{testlib::FULL_COLLECTION, Artist, ArtistId, Collection};
use crate::{musichoard::testmod::FULL_COLLECTION, Artist, ArtistId, Collection};
use super::*;
use testmod::DATABASE_JSON;

View File

@ -22,6 +22,7 @@ pub use collection::{
// FIXME: validate the re-exports
pub use musichoard::{MusicHoard, MusicHoardBuilder, NoDatabase, NoLibrary};
// FIXME: this should be in the musichoard module.
/// Error type for `musichoard`.
#[derive(Debug, PartialEq, Eq)]
pub enum Error {
@ -89,7 +90,4 @@ impl From<InvalidUrlError> for Error {
#[cfg(test)]
#[macro_use]
mod testmacros;
#[cfg(test)]
mod testlib;
mod tests;

View File

@ -128,7 +128,4 @@ fn main() {
#[cfg(test)]
#[macro_use]
mod testmacros;
#[cfg(test)]
mod testbin;
mod tests;

View File

@ -372,5 +372,8 @@ impl<LIB, DB> MusicHoardBuilder<LIB, DB> {
}
}
#[cfg(test)]
pub mod testmod;
#[cfg(test)]
mod tests;

View File

@ -5,5 +5,7 @@ use crate::collection::{
};
use once_cell::sync::Lazy;
use crate::tests::*;
pub static LIBRARY_COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| library_collection!());
pub static FULL_COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| full_collection!());

View File

@ -2,6 +2,8 @@ use mockall::predicate;
use super::*;
use super::testmod::{FULL_COLLECTION, LIBRARY_COLLECTION};
// FIXME: check all crate::* imports - are the tests where they should be?
use crate::collection::{
artist::{ArtistProperties, Bandcamp, MusicBrainz, MusicButler, Qobuz},
@ -10,7 +12,6 @@ use crate::collection::{
};
use crate::database::{self, MockIDatabase};
use crate::library::{self, testmod::LIBRARY_ITEMS, MockILibrary};
use crate::testlib::{FULL_COLLECTION, LIBRARY_COLLECTION};
static MUSICBRAINZ: &str = "https://musicbrainz.org/artist/d368baa8-21ca-4759-9731-0b2753071ad8";
static MUSICBRAINZ_2: &str = "https://musicbrainz.org/artist/823869a5-5ded-4f6b-9fb7-2a9344d83c6b";

View File

@ -321,3 +321,6 @@ macro_rules! full_collection {
collection
}};
}
pub(crate) use full_collection;
pub(crate) use library_collection;

View File

@ -157,6 +157,9 @@ impl<B: Backend, UI: IUi> Tui<B, UI> {
// GRCOV_EXCL_STOP
}
#[cfg(test)]
mod testmod;
#[cfg(test)]
mod tests {
use std::{io, thread};
@ -164,7 +167,7 @@ mod tests {
use musichoard::Collection;
use ratatui::{backend::TestBackend, Terminal};
use crate::testbin::COLLECTION;
use super::testmod::COLLECTION;
use super::{
event::EventError,

View File

@ -4,4 +4,6 @@ use musichoard::{
};
use once_cell::sync::Lazy;
use crate::tests::*;
pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| full_collection!());

View File

@ -733,8 +733,8 @@ impl<MH: IMusicHoard> IUi for Ui<MH> {
#[cfg(test)]
mod tests {
use crate::testbin::COLLECTION;
use crate::tui::lib::MockIMusicHoard;
use crate::tui::testmod::COLLECTION;
use crate::tui::tests::{terminal, ui};
use super::*;