Skip to content

Commit d6e010b

Browse files
committed
fix(clerk-js): address PR review feedback on state tests
1 parent 5aedb31 commit d6e010b

1 file changed

Lines changed: 0 additions & 30 deletions

File tree

packages/clerk-js/src/core/__tests__/state.test.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ describe('State', () => {
123123
// The previous id 'signup_123' should be gone
124124
expect(signUpResourceSignal().resource).toBe(newSignUpFromReset);
125125
expect(signUpResourceSignal().resource?.id).toBeUndefined();
126-
expect(signUpResourceSignal().resource).not.toBe(existingSignUp);
127126
});
128127

129128
it('should allow resource update when new resource has an id (not a null update)', () => {
@@ -170,35 +169,6 @@ describe('State', () => {
170169
});
171170

172171
describe('Simulated client refresh scenarios', () => {
173-
it('should protect against null update during email verification (before finalize)', () => {
174-
// This test simulates the scenario described in USER-4372:
175-
// 1. User is in the middle of sign up with verified email
176-
// 2. Client refresh happens (e.g., router.refresh in Next.js)
177-
// 3. Server returns sign_up: null because sign up is complete on server side
178-
// 4. The null update should be IGNORED to prevent flash of default form
179-
180-
// Arrange: User has completed email verification but hasn't called finalize yet
181-
const signUp = new SignUp({
182-
id: 'signup_123',
183-
status: 'complete',
184-
created_session_id: 'session_123',
185-
verifications: {
186-
email_address: { status: 'verified' },
187-
},
188-
} as any);
189-
190-
expect(signUpResourceSignal().resource?.id).toBe('signup_123');
191-
expect(signUp.__internal_future.canBeDiscarded).toBe(false);
192-
193-
// Act: Simulate client refresh returning null sign_up
194-
// This is what happens in Client.fromJSON when server returns sign_up: null
195-
const nullSignUp = new SignUp(null);
196-
197-
// Assert: The null update should be IGNORED
198-
expect(signUpResourceSignal().resource?.id).toBe('signup_123');
199-
expect(signUpResourceSignal().resource).toBe(signUp);
200-
});
201-
202172
it('should allow null update after finalize sets canBeDiscarded to true', async () => {
203173
// This test verifies that after finalize() is called,
204174
// the null update IS allowed (because canBeDiscarded is true)

0 commit comments

Comments
 (0)