Debian Codegraph @

pkg/format/urlpart_test.go

raw
1 package format_test
2
3 import (
4 "github.com/onsi/ginkgo/v2"
5 "github.com/onsi/gomega"
6
7 "github.com/nicholas-fedor/shoutrrr/pkg/format"
8 )
9
10 var _ = ginkgo.Describe("URLPart", func() {
11 ginkgo.It("should return the expected URL part for each lookup key", func() {
12 gomega.Expect(format.ParseURLPart("user")).To(gomega.Equal(format.URLUser))
13 gomega.Expect(format.ParseURLPart("pass")).To(gomega.Equal(format.URLPassword))
14 gomega.Expect(format.ParseURLPart("password")).To(gomega.Equal(format.URLPassword))
15 gomega.Expect(format.ParseURLPart("host")).To(gomega.Equal(format.URLHost))
16 gomega.Expect(format.ParseURLPart("port")).To(gomega.Equal(format.URLPort))
17 gomega.Expect(format.ParseURLPart("path")).To(gomega.Equal(format.URLPath))
18 gomega.Expect(format.ParseURLPart("path1")).To(gomega.Equal(format.URLPath))
19 gomega.Expect(format.ParseURLPart("path2")).To(gomega.Equal(format.URLPath + 1))
20 gomega.Expect(format.ParseURLPart("path3")).To(gomega.Equal(format.URLPath + 2))
21 gomega.Expect(format.ParseURLPart("path4")).To(gomega.Equal(format.URLPath + 3))
22 gomega.Expect(format.ParseURLPart("query")).To(gomega.Equal(format.URLQuery))
23 gomega.Expect(format.ParseURLPart("")).To(gomega.Equal(format.URLQuery))
24 })
25 ginkgo.It("should return the expected suffix for each URL part", func() {
26 gomega.Expect(format.URLUser.Suffix()).To(gomega.Equal(':'))
27 gomega.Expect(format.URLPassword.Suffix()).To(gomega.Equal('@'))
28 gomega.Expect(format.URLHost.Suffix()).To(gomega.Equal(':'))
29 gomega.Expect(format.URLPort.Suffix()).To(gomega.Equal('/'))
30 gomega.Expect(format.URLPath.Suffix()).To(gomega.Equal('/'))
31 })
32 })