no message
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user