| 1 | package ntfy |
| 2 | |
| 3 | import ( |
| 4 | "github.com/onsi/ginkgo/v2" |
| 5 | "github.com/onsi/gomega" |
| 6 | ) |
| 7 | |
| 8 | var _ = ginkgo.Describe("Priority", func() { |
| 9 | ginkgo.Describe("String", func() { |
| 10 | ginkgo.It("should return 'Min' for PriorityMin", func() { |
| 11 | gomega.Expect(PriorityMin.String()).To(gomega.Equal("Min")) |
| 12 | }) |
| 13 | |
| 14 | ginkgo.It("should return 'Low' for PriorityLow", func() { |
| 15 | gomega.Expect(PriorityLow.String()).To(gomega.Equal("Low")) |
| 16 | }) |
| 17 | |
| 18 | ginkgo.It("should return 'Default' for PriorityDefault", func() { |
| 19 | gomega.Expect(PriorityDefault.String()).To(gomega.Equal("Default")) |
| 20 | }) |
| 21 | |
| 22 | ginkgo.It("should return 'High' for PriorityHigh", func() { |
| 23 | gomega.Expect(PriorityHigh.String()).To(gomega.Equal("High")) |
| 24 | }) |
| 25 | |
| 26 | ginkgo.It("should return 'Max' for PriorityMax", func() { |
| 27 | gomega.Expect(PriorityMax.String()).To(gomega.Equal("Max")) |
| 28 | }) |
| 29 | |
| 30 | ginkgo.It("should return formatted string for unknown values", func() { |
| 31 | unknown := priority(99) |
| 32 | result := unknown.String() |
| 33 | gomega.Expect(result).NotTo(gomega.BeEmpty()) |
| 34 | }) |
| 35 | }) |
| 36 | |
| 37 | ginkgo.Describe("Priority values", func() { |
| 38 | ginkgo.It("should have correct numeric values", func() { |
| 39 | gomega.Expect(int(PriorityMin)).To(gomega.Equal(1)) |
| 40 | gomega.Expect(int(PriorityLow)).To(gomega.Equal(2)) |
| 41 | gomega.Expect(int(PriorityDefault)).To(gomega.Equal(3)) |
| 42 | gomega.Expect(int(PriorityHigh)).To(gomega.Equal(4)) |
| 43 | gomega.Expect(int(PriorityMax)).To(gomega.Equal(5)) |
| 44 | }) |
| 45 | }) |
| 46 | |
| 47 | ginkgo.Describe("Priority enum formatter", func() { |
| 48 | ginkgo.It("should have non-nil Enum formatter", func() { |
| 49 | gomega.Expect(Priority.Enum).NotTo(gomega.BeNil()) |
| 50 | }) |
| 51 | |
| 52 | ginkgo.It("should map string names to values", func() { |
| 53 | gomega.Expect(Priority.Enum.Parse("High")).To(gomega.Equal(int(PriorityHigh))) |
| 54 | }) |
| 55 | }) |
| 56 | }) |