no message

This commit is contained in:
yinjun.chen1
2026-09-14 15:38:07 +08:00
parent f22b45ba5b
commit 1fd3cfbd44
7 changed files with 1839 additions and 216 deletions
+7 -2
View File
@@ -41,7 +41,11 @@ function loadContentJs(mockDoc) {
window: { location: { href: "https://example.com/login" } },
document: mockDoc,
chrome: {
runtime: { onMessage: { addListener() {} } },
runtime: {
onMessage: { addListener() {} },
},
// i18n mock:getMessage 返回 key 自身作为文案(fallback)
i18n: { getMessage: (key) => key || "" },
storage: {
local: { get: async () => ({}), set: async () => {}, remove: async () => {} },
session: { get: async () => ({}), set: async () => {}, remove: async () => {} },
@@ -85,7 +89,8 @@ describe("detectCaptcha", () => {
const r = sb.detectCaptcha();
assert.ok(r);
assert.equal(r.type, "reCAPTCHA");
assert.match(r.reason, /reCAPTCHA/);
// reason 由 i18n 提供,测试环境 fallback 到 key,断言非空字符串
assert.ok(typeof r.reason === "string" && r.reason.length > 0);
});
it("检测到 reCAPTCHA iframe", () => {