navidrome/utils/sanitize_strings_test.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
816 B
Go
Raw Permalink Normal View History

package utils
import (
2022-07-26 22:47:16 +02:00
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("SanitizeStrings", func() {
It("returns all lowercase chars", func() {
Expect(SanitizeStrings("Some Text")).To(Equal("some text"))
})
It("removes accents", func() {
Expect(SanitizeStrings("Quintão")).To(Equal("quintao"))
})
It("remove extra spaces", func() {
Expect(SanitizeStrings(" some text ")).To(Equal("some text"))
})
It("remove duplicated words", func() {
Expect(SanitizeStrings("legião urbana urbana legiÃo")).To(Equal("legiao urbana"))
})
It("remove symbols", func() {
Expect(SanitizeStrings("Toms Diner ' “40” A")).To(Equal("40 a diner toms"))
})
It("remove opening brackets", func() {
Expect(SanitizeStrings("[Five Years]")).To(Equal("five years"))
})
})