feat: 门户接入企微网页授权——企微内静默免输身份领取,浏览器外保留手动输入

This commit is contained in:
ABAPPLO
2026-08-31 17:17:00 +08:00
parent 6e590e3b08
commit ca3810a3d0
4 changed files with 326 additions and 30 deletions

View File

@@ -170,3 +170,29 @@ test("creates anonymous delegation bundles and reuses one-to-one backfill", asyn
assert.match(styles, /\.share-checkbox/);
assert.match(styles, /\.delegation-history/);
});
test("wires silent wecom oauth with full manual fallback", async () => {
const [page, styles] = await Promise.all([
readFile(new URL("../app/page.tsx", import.meta.url), "utf8"),
readFile(new URL("../app/globals.css", import.meta.url), "utf8"),
]);
assert.match(page, /NEXT_PUBLIC_WECOM_CORP_ID/);
assert.match(page, /NEXT_PUBLIC_WECOM_AGENT_ID/);
assert.match(page, /snsapi_base/);
assert.match(page, /connect\/oauth2\/authorize/);
assert.match(page, /wxwork\/i\.test\(userAgent\)/);
assert.match(page, /MicroMessenger\/i\.test\(userAgent\)/);
assert.match(page, /"koc-wecom-identity"/);
assert.match(page, /"koc-wecom-auth-failed"/);
assert.match(page, /\/api\/wecom-oauth/);
assert.match(page, /restoreParamsFromWecomState/);
assert.match(page, /buildWecomOAuthState/);
assert.match(page, /identityTicket: wecomIdentity\.ticket/);
assert.match(page, /企微身份已确认/);
assert.match(page, /切换为手动输入/);
assert.match(page, /window\.location\.replace\(/);
assert.match(styles, /\.wecom-identity-chip/);
assert.match(page, /\(!wecomIdentity \|\| manualEntry\)/);
assert.match(page, /claimantIdentifier:\s*claimantName/);
});