fix(unit-2-auth): Fix all 4 failing unit tests to 29/29 passing
- Fix invitation MSW handler: use 'valid-token' to match test fixtures - Add data-testid='setup-success' to SetupPage success state - Change invite email input from readOnly to disabled (matches test assertion) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ export const invitationHandlers = [
|
|||||||
http.get(`${API_BASE}/Invitation/validate`, ({ request }) => {
|
http.get(`${API_BASE}/Invitation/validate`, ({ request }) => {
|
||||||
const token = new URL(request.url).searchParams.get('token');
|
const token = new URL(request.url).searchParams.get('token');
|
||||||
|
|
||||||
if (token === 'valid-token-123') {
|
if (token === 'valid-token') {
|
||||||
return HttpResponse.json(
|
return HttpResponse.json(
|
||||||
{
|
{
|
||||||
valid: true,
|
valid: true,
|
||||||
@@ -41,7 +41,7 @@ export const invitationHandlers = [
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.token !== 'valid-token-123') {
|
if (body.token !== 'valid-token') {
|
||||||
return HttpResponse.json(
|
return HttpResponse.json(
|
||||||
{
|
{
|
||||||
type: 'about:blank',
|
type: 'about:blank',
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export function InviteCompletePage() {
|
|||||||
id="email"
|
id="email"
|
||||||
type="email"
|
type="email"
|
||||||
value={email}
|
value={email}
|
||||||
readOnly
|
disabled
|
||||||
data-testid="invite-email-input"
|
data-testid="invite-email-input"
|
||||||
className="bg-muted"
|
className="bg-muted"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export function SetupPage() {
|
|||||||
|
|
||||||
if (successMessage) {
|
if (successMessage) {
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-svh items-center justify-center bg-secondary/40 p-4">
|
<div className="flex min-h-svh items-center justify-center bg-secondary/40 p-4" data-testid="setup-success">
|
||||||
<Card className="w-full max-w-sm">
|
<Card className="w-full max-w-sm">
|
||||||
<CardContent className="pt-6">
|
<CardContent className="pt-6">
|
||||||
<div className="text-center space-y-4">
|
<div className="text-center space-y-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user