Skip to content

Commit

Permalink
relax email+channel validation until consumer tests updated
Browse files Browse the repository at this point in the history
  • Loading branch information
acsauk committed May 1, 2024
1 parent e2aade5 commit f186be8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions lambda/create/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ func validateTrustCorporation(prefix string, trustCorporation shared.TrustCorpor
validate.Address(fmt.Sprintf("%s/address", prefix), trustCorporation.Address),
validate.IsValid(fmt.Sprintf("%s/channel", prefix), trustCorporation.Channel),
validate.IsValid(fmt.Sprintf("%s/status", prefix), trustCorporation.Status),
validate.IfElse(trustCorporation.Channel == shared.ChannelOnline,
validate.Required(fmt.Sprintf("%s/email", prefix), trustCorporation.Email),
validate.Empty(fmt.Sprintf("%s/email", prefix), trustCorporation.Email)),
//validate.IfElse(trustCorporation.Channel == shared.ChannelOnline,
// validate.Required(fmt.Sprintf("%s/email", prefix), trustCorporation.Email),
// validate.Empty(fmt.Sprintf("%s/email", prefix), trustCorporation.Email)),
)
}
50 changes: 25 additions & 25 deletions lambda/create/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,31 +299,31 @@ func TestValidateLpaInvalid(t *testing.T) {
{Source: "/lifeSustainingTreatmentOption", Detail: "field must not be provided"},
},
},
"online trust corporation missing email": {
lpa: shared.LpaInit{
TrustCorporations: []shared.TrustCorporation{
{
Channel: shared.ChannelOnline,
},
},
},
contains: []shared.FieldError{
{Source: "/trustCorporations/0/email", Detail: "field is required"},
},
},
"paper trust corporation with email": {
lpa: shared.LpaInit{
TrustCorporations: []shared.TrustCorporation{
{
Channel: shared.ChannelPaper,
Email: "[email protected]",
},
},
},
contains: []shared.FieldError{
{Source: "/trustCorporations/0/email", Detail: "field must not be provided"},
},
},
//"online trust corporation missing email": {
// lpa: shared.LpaInit{
// TrustCorporations: []shared.TrustCorporation{
// {
// Channel: shared.ChannelOnline,
// },
// },
// },
// contains: []shared.FieldError{
// {Source: "/trustCorporations/0/email", Detail: "field is required"},
// },
//},
//"paper trust corporation with email": {
// lpa: shared.LpaInit{
// TrustCorporations: []shared.TrustCorporation{
// {
// Channel: shared.ChannelPaper,
// Email: "[email protected]",
// },
// },
// },
// contains: []shared.FieldError{
// {Source: "/trustCorporations/0/email", Detail: "field must not be provided"},
// },
//},
}

for name, tc := range testcases {
Expand Down

0 comments on commit f186be8

Please sign in to comment.