forked from cartsnitch/cartsnitch
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:
committed by
Barcode Betty
parent
5e5f13c5b5
commit
b6da52fb07
+3
-19
@@ -20,6 +20,7 @@ function mockAuthRoutes(page: Page, authenticated = false) {
|
|||||||
status: 200,
|
status: 200,
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
token: null,
|
||||||
user: {
|
user: {
|
||||||
id: MOCK_USER_ID,
|
id: MOCK_USER_ID,
|
||||||
email: "mock@cartsnitch.test",
|
email: "mock@cartsnitch.test",
|
||||||
@@ -28,15 +29,6 @@ function mockAuthRoutes(page: Page, authenticated = false) {
|
|||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
updatedAt: 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,
|
status: 200,
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
redirect: false,
|
||||||
|
token: "mock_token_123",
|
||||||
user: {
|
user: {
|
||||||
id: MOCK_USER_ID,
|
id: MOCK_USER_ID,
|
||||||
email: "mock@cartsnitch.test",
|
email: "mock@cartsnitch.test",
|
||||||
@@ -54,15 +48,6 @@ function mockAuthRoutes(page: Page, authenticated = false) {
|
|||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
updatedAt: 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({
|
body: JSON.stringify({
|
||||||
session: {
|
session: {
|
||||||
id: MOCK_SESSION_ID,
|
id: MOCK_SESSION_ID,
|
||||||
userId: MOCK_USER_ID,
|
|
||||||
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
|
expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user