Update creation flow refactor docs and auth test fixtures

This commit is contained in:
2026-04-21 11:19:25 +08:00
parent 13bc79306f
commit 04bff9617d
37 changed files with 488 additions and 7 deletions

View File

@@ -122,6 +122,11 @@ function createTestConfig(
mockAvatarUrl: '',
},
authSession: {
accessCookieName: 'genarrative_access_session',
accessCookieTtlSeconds: 7200,
accessCookieSecure: false,
accessCookieSameSite: 'Lax',
accessCookiePath: '/',
refreshCookieName: 'genarrative_refresh_session',
refreshSessionTtlDays: 30,
refreshCookieSecure: false,
@@ -467,7 +472,18 @@ async function startWechatMockFlow(baseUrl: string, redirectPath = '/') {
const location = callbackResponse.headers.get('location') || '';
assert.ok(location);
const hash = parseRedirectHash(location);
const token = hash.get('auth_token') || '';
const setCookieHeader = callbackResponse.headers.get('set-cookie') || '';
const accessCookie = setCookieHeader
.split(',')
.map((entry) => entry.trim())
.find((entry) => entry.startsWith('genarrative_access_session='));
const token =
accessCookie
?.split(';')[0]
?.split('=')
.slice(1)
.join('=')
.trim() || '';
assert.ok(token);