mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-28 11:35:40 +00:00
fix failing tests
This commit is contained in:
parent
e71146df3d
commit
3cfd274212
3 changed files with 9 additions and 5 deletions
|
@ -43,7 +43,7 @@ type (
|
||||||
NotifierUpdate struct {
|
NotifierUpdate struct {
|
||||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||||
IsActive bool `json:"isActive"`
|
IsActive bool `json:"isActive"`
|
||||||
URL *string `json:"url" extensions:"x-nullable" validate:"omitempty,shoutrrr"`
|
URL *string `json:"url" validate:"omitempty,shoutrrr" extensions:"x-nullable" `
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifierOut struct {
|
NotifierOut struct {
|
||||||
|
|
|
@ -11,7 +11,7 @@ var validate *validator.Validate
|
||||||
func init() {
|
func init() {
|
||||||
validate = validator.New()
|
validate = validator.New()
|
||||||
|
|
||||||
validate.RegisterValidation("shoutrrr", func(fl validator.FieldLevel) bool {
|
err := validate.RegisterValidation("shoutrrr", func(fl validator.FieldLevel) bool {
|
||||||
prefixes := [...]string{
|
prefixes := [...]string{
|
||||||
"discord://",
|
"discord://",
|
||||||
"smtp://",
|
"smtp://",
|
||||||
|
@ -45,6 +45,10 @@ func init() {
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks a struct for validation errors and returns any errors the occur. This
|
// Checks a struct for validation errors and returns any errors the occur. This
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe("basic notifier workflows", () => {
|
||||||
// Create Notifier
|
// Create Notifier
|
||||||
const result = await client.notifiers.create({
|
const result = await client.notifiers.create({
|
||||||
name: faker.name.firstName(),
|
name: faker.name.firstName(),
|
||||||
url: faker.internet.url(),
|
url: "discord://" + faker.random.alphaNumeric(10),
|
||||||
isActive: true,
|
isActive: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ describe("basic notifier workflows", () => {
|
||||||
{
|
{
|
||||||
const updateData = {
|
const updateData = {
|
||||||
name: faker.name.firstName(),
|
name: faker.name.firstName(),
|
||||||
url: faker.internet.url(),
|
url: "discord://" + faker.random.alphaNumeric(10),
|
||||||
isActive: true,
|
isActive: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ describe("basic notifier workflows", () => {
|
||||||
{
|
{
|
||||||
const updateData = {
|
const updateData = {
|
||||||
name: faker.name.firstName(),
|
name: faker.name.firstName(),
|
||||||
url: "",
|
url: null,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue