Skip to content

Commit

Permalink
add host template test for shoutrrr
Browse files Browse the repository at this point in the history
  • Loading branch information
piksel committed Jan 5, 2022
1 parent 8805046 commit 0e52235
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/notifications/shoutrrr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ var mockDataAllFresh = Data{
}

func mockDataFromStates(states ...s.State) Data {
hostname := "Mock"
return Data{
Entries: legacyMockData.Entries,
Report: mocks.CreateMockProgressReport(states...),
Title: "Updates on Mock",
Title: GetTitle(hostname),
Host: hostname,
}
}

Expand Down Expand Up @@ -180,12 +182,20 @@ var _ = Describe("Shoutrrr", func() {

When("using a template referencing Title", func() {
It("should contain the title in the output", func() {
expected := `Updates on Mock`
expected := `Watchtower updates on Mock`
data := mockDataFromStates(s.UpdatedState)
Expect(getTemplatedResult(`{{ .Title }}`, false, data)).To(Equal(expected))
})
})

When("using a template referencing Host", func() {
It("should contain the hostname in the output", func() {
expected := `Mock`
data := mockDataFromStates(s.UpdatedState)
Expect(getTemplatedResult(`{{ .Host }}`, false, data)).To(Equal(expected))
})
})

Describe("the default template", func() {
When("all containers are fresh", func() {
It("should return an empty string", func() {
Expand Down

0 comments on commit 0e52235

Please sign in to comment.