mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-29 00:25:31 +03:00
extended domain validation (#24)
This commit is contained in:
parent
d15ed7ffec
commit
6ae7bdc9a3
@ -17,7 +17,7 @@ var (
|
|||||||
}
|
}
|
||||||
markdownSymbols = []string{"*", "_", "`", "["}
|
markdownSymbols = []string{"*", "_", "`", "["}
|
||||||
regCommandName = regexp.MustCompile(
|
regCommandName = regexp.MustCompile(
|
||||||
`^https://?[\da-z.-]+\.(retailcrm\.(ru|pro|es)|ecomlogic\.com|simlachat\.(com|ru))/?$`)
|
`^https://?[\da-z.-]+\.(retailcrm\.(ru|pro|es)|ecomlogic\.com|simla(chat)?\.(com|ru))/?$`)
|
||||||
slashRegex = regexp.MustCompile(`/+$`)
|
slashRegex = regexp.MustCompile(`/+$`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,10 +54,22 @@ func (s *ValidatorSuite) Test_ValidationFails() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ValidatorSuite) Test_ValidationSuccess() {
|
func (s *ValidatorSuite) Test_ValidationSuccess() {
|
||||||
conn := Connection{
|
domains := []string{
|
||||||
Key: "key",
|
"https://asd.retailcrm.ru",
|
||||||
URL: "https://test.retailcrm.pro",
|
"https://test.retailcrm.pro",
|
||||||
|
"https://raisa.retailcrm.es",
|
||||||
|
"https://blabla.simla.com",
|
||||||
|
"https://blabla.simla.ru",
|
||||||
|
"https://blabla.simlachat.com",
|
||||||
|
"https://blabla.simlachat.ru",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, domain := range domains {
|
||||||
|
conn := Connection{
|
||||||
|
Key: "key",
|
||||||
|
URL: domain,
|
||||||
|
}
|
||||||
|
err := s.engine.Struct(conn)
|
||||||
|
assert.NoError(s.T(), err, s.getError(err))
|
||||||
}
|
}
|
||||||
err := s.engine.Struct(conn)
|
|
||||||
assert.NoError(s.T(), err, s.getError(err))
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user