Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(tests): align maskEmail test assertions with new less-aggressive masking behavior

diegosouzapwe89015649ea5
diff --git a/src/shared/utils/maskEmail.ts b/src/shared/utils/maskEmail.ts
index d31d1c2ecf..420183ec89 100644
--- a/src/shared/utils/maskEmail.ts
+++ b/src/shared/utils/maskEmail.ts
@@ -5,7 +5,7 @@
* to prevent identity exposure in dashboards and logs.
*
* @example
- * maskEmail("[email protected]") // "di*********@g****.com"
+ * maskEmail("[email protected]") // "die********@gmail.com"
* maskEmail("[email protected]") // "[email protected]" (too short to mask)
*/
export function maskEmail(email: string | null | undefined, visibleChars = 3): string {
diff --git a/tests/unit/mask-email.test.mjs b/tests/unit/mask-email.test.mjs
index 90ecaaa20f..5bed1839e7 100644
--- a/tests/unit/mask-email.test.mjs
+++ b/tests/unit/mask-email.test.mjs
@@ -8,7 +8,7 @@ import {
describe("maskEmail", () => {
it("masks standard email correctly", () => {
- assert.equal(maskEmail("[email protected]"), "di*********@g****.com");
+ assert.equal(maskEmail("[email protected]"), "die********@gmail.com");
});
it("masks email with short username (exactly visibleChars)", () => {
@@ -18,7 +18,7 @@ describe("maskEmail", () => {
it("masks email with longer username", () => {
const result = maskEmail("[email protected]");
- assert.equal(result, "he***@e******.com");
+ assert.equal(result, "hel**@example.com");
});
it("returns empty string for null", () => {
@@ -54,14 +54,14 @@ describe("maskEmail", () => {
});
it("masks email-like values stored in generic labels", () => {
- assert.equal(maskEmailLikeValue("[email protected]"), "pe****@e******.com");
+ assert.equal(maskEmailLikeValue("[email protected]"), "per***@example.com");
assert.equal(maskEmailLikeValue("Work Account"), "Work Account");
});
it("picks the first non-empty masked display value", () => {
assert.equal(
pickMaskedDisplayValue(["", "[email protected]", "fallback"], "fallback"),
- "pe****@e******.com"
+ "per***@example.com"
);
assert.equal(pickMaskedDisplayValue([null, "Workspace"], "fallback"), "Workspace");
});
diff --git a/tests/unit/model-sync-route.test.mjs b/tests/unit/model-sync-route.test.mjs
index e7e1706ce6..89838d0834 100644
--- a/tests/unit/model-sync-route.test.mjs
+++ b/tests/unit/model-sync-route.test.mjs
@@ -435,7 +435,7 @@ test("model sync route records added, removed, and updated model diffs with fall
assert.equal(logs.length, 1);
assert.equal(logs[0].status, 200);
assert.equal(logs[0].provider, "openrouter");
- assert.ok(logs[0].account.includes("**"), `Expected masked email, got: ${logs[0].account}`);
+ assert.ok(logs[0].account.includes("*"), `Expected masked email, got: ${logs[0].account}`);
});
test("model sync route accepts external API-key auth, forwards cookies, filters built-ins, and syncs aliases", async () => {