SearchAPI: Fixing tests of the episode search api

This commit is contained in:
Zoe Roux 2021-11-11 22:15:53 +01:00
parent c904f0bf28
commit 6a899e2543
No known key found for this signature in database
GPG Key ID: 8BB9CF5EF72AE933
2 changed files with 5 additions and 1 deletions

View File

@ -120,13 +120,16 @@ namespace Kyoo.Core.Controllers
/// <inheritdoc />
public override async Task<ICollection<Episode>> Search(string query)
{
return await _database.Episodes
List<Episode> ret = await _database.Episodes
.Include(x => x.Show)
.Where(x => x.EpisodeNumber != null || x.AbsoluteNumber != null)
.Where(_database.Like<Episode>(x => x.Title, $"%{query}%"))
.OrderBy(DefaultSort)
.Take(20)
.ToListAsync();
foreach (Episode ep in ret)
ep.Show.Episodes = null;
return ret;
}
/// <inheritdoc />

View File

@ -338,6 +338,7 @@ namespace Kyoo.Tests.Database
};
await _repository.Create(value);
ICollection<Episode> ret = await _repository.Search(query);
value.Show = TestSample.Get<Show>();
KAssert.DeepEqual(value, ret.First());
}
}