fix: unify email identity sync and retry first-bind defaults

This commit is contained in:
IanShaw027
2026-04-21 01:00:59 +08:00
parent 7a9488ff37
commit ea27ac6fd7
7 changed files with 154 additions and 78 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestUpdateProfile_ReplacesEmailAuthIdentityWhenEmailChanges(t *testing.T) {
func TestUpdateProfile_DoesNotReturnPartialSuccessFromEmailIdentityResync(t *testing.T) {
repo := &emailSyncRepoStub{
user: &User{
ID: 19,
@@ -17,6 +17,7 @@ func TestUpdateProfile_ReplacesEmailAuthIdentityWhenEmailChanges(t *testing.T) {
Username: "tester",
Concurrency: 2,
},
replaceErr: context.DeadlineExceeded,
}
svc := NewUserService(repo, nil, nil, nil)
@@ -28,10 +29,6 @@ func TestUpdateProfile_ReplacesEmailAuthIdentityWhenEmailChanges(t *testing.T) {
require.NotNil(t, updated)
require.Equal(t, newEmail, updated.Email)
require.Equal(t, 1, repo.updateCalls)
require.Equal(t, []replaceEmailCall{{
userID: 19,
oldEmail: "profile-before@example.com",
newEmail: "profile-after@example.com",
}}, repo.replaceCalls)
require.Empty(t, repo.replaceCalls)
require.Empty(t, repo.ensureCalls)
}