fix(e2e): correct Better Auth mock response formats

- sign-up returns { token, user }
- sign-in returns { redirect, token, user }
- get-session returns { session, user }

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Barcode Betty
2026-04-15 11:06:19 +00:00
committed by Barcode Betty
parent 5e5f13c5b5
commit b6da52fb07
+3 -19
View File
@@ -20,6 +20,7 @@ function mockAuthRoutes(page: Page, authenticated = false) {
status: 200,
contentType: "application/json",
body: JSON.stringify({
token: null,
user: {
id: MOCK_USER_ID,
email: "mock@cartsnitch.test",
@@ -28,15 +29,6 @@ function mockAuthRoutes(page: Page, authenticated = false) {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
session: {
id: MOCK_SESSION_ID,
userId: MOCK_USER_ID,
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
ipAddress: null,
userAgent: null,
},
}),
});
});
@@ -46,6 +38,8 @@ function mockAuthRoutes(page: Page, authenticated = false) {
status: 200,
contentType: "application/json",
body: JSON.stringify({
redirect: false,
token: "mock_token_123",
user: {
id: MOCK_USER_ID,
email: "mock@cartsnitch.test",
@@ -54,15 +48,6 @@ function mockAuthRoutes(page: Page, authenticated = false) {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
session: {
id: MOCK_SESSION_ID,
userId: MOCK_USER_ID,
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
ipAddress: null,
userAgent: null,
},
}),
});
});
@@ -75,7 +60,6 @@ function mockAuthRoutes(page: Page, authenticated = false) {
body: JSON.stringify({
session: {
id: MOCK_SESSION_ID,
userId: MOCK_USER_ID,
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),