Skip to content

Commit 77d96ee

Browse files
mromaszewiczclaude
andcommitted
fix: update test expectations for email validation behavior change
Invalid emails no longer persist their value after failed UnmarshalJSON validation, since the new net/mail-based validation sets the value only after successful parsing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bb4dd92 commit 77d96ee

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

types/email_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ func TestEmail_UnmarshalJSON_RequiredEmail_Validation(t *testing.T) {
7676
"it should fail validating an invalid email": {
7777
jsonStr: `{"email":"not-an-email"}`,
7878
expectedError: ErrValidationEmail,
79-
expectedEmail: func() Email {
80-
e := Email("not-an-email")
81-
return e
82-
}(),
79+
expectedEmail: Email(""),
8380
},
8481
"it should fail validating an empty email": {
8582
jsonStr: `{"email":""}`,
@@ -139,7 +136,7 @@ func TestEmail_UnmarshalJSON_NullableEmail_Validation(t *testing.T) {
139136
jsonStr: `{"email":"not-an-email"}`,
140137
expectedError: ErrValidationEmail,
141138
expectedEmail: func() *Email {
142-
e := Email("not-an-email")
139+
e := Email("")
143140
return &e
144141
}(),
145142
},

0 commit comments

Comments
 (0)