Skip to content

Commit a233ddb

Browse files
authored
test(ui): Drop low-signal flaky SignUpStart unsafeMetadata test (#8529)
1 parent c5fd14c commit a233ddb

2 files changed

Lines changed: 2 additions & 53 deletions

File tree

.changeset/famous-bats-tan.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/ui/src/components/SignUp/__tests__/SignUpStart.test.tsx

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -523,57 +523,4 @@ describe('SignUpStart', () => {
523523
await waitFor(() => screen.getByText(/create your account/i));
524524
});
525525
});
526-
527-
describe('unsafeMetadata', () => {
528-
it('does not throw when signUp.create rejects with an API error', async () => {
529-
Object.defineProperty(window, 'location', {
530-
writable: true,
531-
value: { href: 'http://localhost/sign-up' },
532-
});
533-
534-
let unhandledError: unknown = null;
535-
const onUnhandledRejection = (reason: unknown) => {
536-
unhandledError = reason;
537-
};
538-
process.on('unhandledRejection', onUnhandledRejection);
539-
540-
const { wrapper, fixtures, props } = await createFixtures(f => {
541-
f.withEmailAddress({ required: true });
542-
f.withPassword({ required: true });
543-
});
544-
fixtures.signUp.create.mockRejectedValueOnce(
545-
new ClerkAPIResponseError('Error', {
546-
data: [
547-
{
548-
code: 'form_password_pwned',
549-
long_message: 'Password has been found in an online data breach.',
550-
message: 'Password has been found in an online data breach.',
551-
meta: { param_name: 'password' },
552-
},
553-
],
554-
status: 422,
555-
}),
556-
);
557-
props.setProps({ unsafeMetadata: { foo: 'bar' } });
558-
559-
const { userEvent } = render(
560-
<CardStateProvider>
561-
<SignUpStart />
562-
</CardStateProvider>,
563-
{ wrapper },
564-
);
565-
566-
await userEvent.type(screen.getByLabelText(/email address/i), 'test@example.com');
567-
await userEvent.type(screen.getByPlaceholderText(/create a password/i), 'password123');
568-
await userEvent.click(screen.getByText(/continue/i));
569-
570-
await waitFor(() => expect(fixtures.signUp.create).toHaveBeenCalled());
571-
await screen.findByTestId('form-feedback-error');
572-
// Flush pending microtasks so any unhandled rejection event has a chance to fire.
573-
await new Promise(resolve => setTimeout(resolve, 0));
574-
575-
process.off('unhandledRejection', onUnhandledRejection);
576-
expect(unhandledError).toBeNull();
577-
}, 15_000);
578-
});
579526
});

0 commit comments

Comments
 (0)