mirror of
https://github.com/navidrome/navidrome.git
synced 2026-04-26 10:30:46 +00:00
test: add NotInPlaylist integration test for same-owner private playlists
This commit is contained in:
parent
225938911d
commit
9db08903c9
1 changed files with 26 additions and 0 deletions
|
|
@ -236,6 +236,32 @@ var _ = Describe("PlaylistRepository", func() {
|
|||
Expect(pls.Tracks).To(HaveLen(1))
|
||||
Expect(pls.Tracks[0].MediaFileID).To(Equal(songDayInALife.ID))
|
||||
})
|
||||
|
||||
It("should exclude tracks from the private playlist when using NotInPlaylist", func() {
|
||||
conf.Server.SmartPlaylistRefreshDelay = -1 * time.Second
|
||||
|
||||
childRules := &criteria.Criteria{
|
||||
Expression: criteria.All{
|
||||
criteria.Contains{"title": "Day"},
|
||||
},
|
||||
}
|
||||
nestedPls := model.Playlist{Name: "Private Nested Excluded", OwnerID: "userid", Public: false, Rules: childRules}
|
||||
Expect(repo.Put(&nestedPls)).To(Succeed())
|
||||
DeferCleanup(func() { _ = repo.Delete(nestedPls.ID) })
|
||||
|
||||
parentPls := model.Playlist{Name: "Parent Excluding Private", OwnerID: "userid", Rules: &criteria.Criteria{
|
||||
Expression: criteria.All{
|
||||
criteria.Contains{"title": "Day"},
|
||||
criteria.NotInPlaylist{"id": nestedPls.ID},
|
||||
},
|
||||
}}
|
||||
Expect(repo.Put(&parentPls)).To(Succeed())
|
||||
DeferCleanup(func() { _ = repo.Delete(parentPls.ID) })
|
||||
|
||||
pls, err := repo.GetWithTracks(parentPls.ID, true, false)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(pls.Tracks).To(HaveLen(0))
|
||||
})
|
||||
})
|
||||
|
||||
When("refresh delay has not expired", func() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue