Skip to content

Commit

Permalink
Reference field is optional for CONFIRM_IDENTITY updates
Browse files Browse the repository at this point in the history
  • Loading branch information
townxelliot committed Jun 13, 2024
1 parent 319f975 commit 5ead733
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions lambda/update/confirm_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ func validateConfirmIdentity(prefix string, actor idccActor, ic *shared.Identity
Field("/checkedAt", &ic.CheckedAt, parse.Validate(func() []shared.FieldError {
return validate.Time("", ic.CheckedAt)
}), parse.MustMatchExisting()).
Field("/reference", &ic.Reference, parse.Validate(func() []shared.FieldError {
return validate.Required("", ic.Reference)
}), parse.MustMatchExisting()).
Field("/reference", &ic.Reference, parse.Optional(), parse.MustMatchExisting()).
Consumed()
}).Errors()

Expand Down
6 changes: 3 additions & 3 deletions lambda/update/confirm_identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestConfirmIdentityDonorBadFieldsFails(t *testing.T) {
Old: json.RawMessage("null"),
New: json.RawMessage(`"` + time.Now().Format(time.RFC3339Nano) + `"`),
},
// empty required field
// empty optional field - does not cause an error message
{
Key: "/donor/identityCheck/reference",
Old: json.RawMessage("null"),
Expand All @@ -63,9 +63,9 @@ func TestConfirmIdentityDonorBadFieldsFails(t *testing.T) {

idCheckComplete, errors := validateDonorConfirmIdentity(changes, &shared.Lpa{})

// errors: missing "checkedAt" field, invalid value for "type" field, empty "reference" field,
// errors: missing "checkedAt" field, invalid value for "type" field,
// unexpected "irrelevantButStillADate" field
assert.Len(t, errors, 4)
assert.Len(t, errors, 3)
assert.Equal(t, &shared.IdentityCheck{Type: "rinky-dink-login-system"}, idCheckComplete.IdentityCheck)
assert.Equal(t, donor, idCheckComplete.Actor)
}
Expand Down

0 comments on commit 5ead733

Please sign in to comment.