refactor: small improvements and clean up (#3423)
* refactor: replace custom map functions with slice.Map * refactor: extract StringerValue function * refactor: removed unnecessary if * chore: removed invalid comment * refactor: replace more map functions * chore: fix FFmpeg typo
This commit is contained in:
@@ -33,6 +33,20 @@ var _ = Describe("Slice Utils", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Describe("MapWithArg", func() {
|
||||
It("returns empty slice for an empty input", func() {
|
||||
mapFunc := func(a int, v int) string { return strconv.Itoa(a + v) }
|
||||
result := slice.MapWithArg([]int{}, 10, mapFunc)
|
||||
Expect(result).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("returns a new slice with elements mapped", func() {
|
||||
mapFunc := func(a int, v int) string { return strconv.Itoa(a + v) }
|
||||
result := slice.MapWithArg([]int{1, 2, 3, 4}, 10, mapFunc)
|
||||
Expect(result).To(ConsistOf("11", "12", "13", "14"))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Group", func() {
|
||||
It("returns empty map for an empty input", func() {
|
||||
keyFunc := func(v int) int { return v % 2 }
|
||||
|
||||
Reference in New Issue
Block a user