mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
test(participants): use neutral names to avoid gosec false positive
The G101 'potential hardcoded credentials' lint flagged a struct field named CreditedAs paired with a string literal. The artist names in the dedup-merge test are arbitrary — rename to plain placeholders.
This commit is contained in:
parent
87cd3f1037
commit
abd9d6bdba
@ -123,32 +123,32 @@ var _ = Describe("Participants", func() {
|
||||
// it isn't silently dropped just because of arrival order.
|
||||
p1 := Participants{
|
||||
RoleArtist: []Participant{
|
||||
{Artist: Artist{ID: "a1", Name: "Aphex Twin"}, CreditedAs: "AFX"},
|
||||
{Artist: Artist{ID: "a1", Name: "Canonical"}, CreditedAs: "Credit One"},
|
||||
},
|
||||
}
|
||||
p2 := Participants{
|
||||
RoleArtist: []Participant{
|
||||
{Artist: Artist{ID: "a1", Name: "Aphex Twin"}, CreditedAs: "Aphex Twin"},
|
||||
{Artist: Artist{ID: "a1", Name: "Canonical"}, CreditedAs: "Credit Two"},
|
||||
},
|
||||
}
|
||||
p1.Merge(p2)
|
||||
Expect(p1[RoleArtist]).To(HaveLen(1))
|
||||
Expect(p1[RoleArtist][0].CreditedAs).To(Equal("Aphex Twin"))
|
||||
Expect(p1[RoleArtist][0].CreditedAs).To(Equal("Credit Two"))
|
||||
})
|
||||
|
||||
It("does not overwrite an existing CreditedAs with an empty one", func() {
|
||||
p1 := Participants{
|
||||
RoleArtist: []Participant{
|
||||
{Artist: Artist{ID: "a1", Name: "Aphex Twin"}, CreditedAs: "AFX"},
|
||||
{Artist: Artist{ID: "a1", Name: "Canonical"}, CreditedAs: "Credit One"},
|
||||
},
|
||||
}
|
||||
p2 := Participants{
|
||||
RoleArtist: []Participant{
|
||||
{Artist: Artist{ID: "a1", Name: "Aphex Twin"}}, // empty CreditedAs
|
||||
{Artist: Artist{ID: "a1", Name: "Canonical"}}, // empty CreditedAs
|
||||
},
|
||||
}
|
||||
p1.Merge(p2)
|
||||
Expect(p1[RoleArtist][0].CreditedAs).To(Equal("AFX"))
|
||||
Expect(p1[RoleArtist][0].CreditedAs).To(Equal("Credit One"))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user