Commit 1bcb0f1c authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

unittests: Ensure too short patterns are correctly rejected

parent 4e5dc271
Pipeline #20142 passed with stage
in 24 minutes and 58 seconds
......@@ -343,6 +343,9 @@ TEST_F( Albums, SearchByTitle )
a2->addTrack( m2, 1, 0, 0, nullptr );
m2->save();
auto query = ml->searchAlbums( "", nullptr );
ASSERT_EQ( nullptr, query );
auto albums = ml->searchAlbums( "otte", nullptr )->all();
ASSERT_EQ( 1u, albums.size() );
}
......
......@@ -278,6 +278,9 @@ TEST_F( Artists, Search )
a1->addMedia( *m1 );
a2->addMedia( *m2 );
auto query = ml->searchArtists( "", ArtistIncluded::All, nullptr );
ASSERT_EQ( nullptr, query );
auto artists = ml->searchArtists( "artist", ArtistIncluded::All, nullptr )->all();
ASSERT_EQ( 2u, artists.size() );
ASSERT_EQ( artists[0]->id(), a1->id() );
......
......@@ -152,6 +152,9 @@ TEST_F( Genres, Search )
ml->createGenre( "something" );
ml->createGenre( "blork" );
auto query = ml->searchGenre( "", nullptr );
ASSERT_EQ( nullptr, query );
auto genres = ml->searchGenre( "genr", nullptr )->all();
ASSERT_EQ( 1u, genres.size() );
}
......
......@@ -225,6 +225,10 @@ TEST_F( Medias, Search )
ml->addMedia( "track " + std::to_string( i ) + ".mp3", IMedia::Type::Audio ) );
m->save();
}
auto query = ml->searchMedia( "", nullptr );
ASSERT_EQ( nullptr, query );
auto media = ml->searchMedia( "tra", nullptr )->all();
ASSERT_EQ( 10u, media.size() );
......
......@@ -259,6 +259,9 @@ TEST_F( Shows, Search )
show2->setReleaseDate( 100 );
media2->save();
auto query = ml->searchShows( "", nullptr );
ASSERT_EQ( nullptr, query );
auto shows = ml->searchShows( "otters" )->all();
ASSERT_EQ( 1u, shows.size() );
ASSERT_EQ( show1->id(), shows[0]->id() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment