Skip to content

Commit

Permalink
Added few testcases for rawURL passed as path/#####channel and path/#…
Browse files Browse the repository at this point in the history
…channel (used to segfault) (#83)

Co-authored-by: Simon Aronsson <[email protected]>
  • Loading branch information
Alexei Tighineanu and simskij authored Nov 24, 2020
1 parent 8ab1296 commit 7857385
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/services/rocketchat/rocketchat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,19 @@ var _ = Describe("the rocketchat service", func() {
Expect(hookURL).To(ContainSubstring("my-domain.com:5055"))
})
})
When("sending to an URL with badly syntaxed #channel name", func() {
It("should properly parse the Channel", func() {
rocketchatURL, _ := url.Parse("rocketchat://[email protected]:5055/tokenA/tokenB/###########################testChannel")
config := &Config{}
config.SetURL(rocketchatURL)
Expect(config.Channel).To(ContainSubstring("###########################testChannel"))
})
It("should properly parse the Channel", func() {
rocketchatURL, _ := url.Parse("rocketchat://[email protected]:5055/tokenA/tokenB/#testChannel")
config := &Config{}
config.SetURL(rocketchatURL)
Expect(config.Channel).To(ContainSubstring("#testChannel"))
})
})
})
})

0 comments on commit 7857385

Please sign in to comment.