fix: add utf8 email validation support (#6239)
Co-authored-by: Thomas <thomas@ajnart.fr>
This commit is contained in:
1 parent
7c152cf4fe
commit
7d93df04dd
6 files changed
+43
-13
No files matched your search
@@ -4,6 +4,7 @@ import { z } from "zod/v4";
|
||||
import type { TranslationFunction } from "@homarr/translation";
|
||||
|
||||
import { createCustomErrorParams, zodErrorMap } from "./i18n";
|
||||
import { utf8EmailSchema } from "../email";
|
||||
|
||||
const expectError = (error: z.core.$ZodIssue, key: string) => {
|
||||
expect(error.message).toContain(key);
|
||||
@@ -111,4 +112,19 @@ describe("i18n", () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
expectError(result.error.issues[0]!, "boardAlreadyExists");
|
||||
});
|
||||
|
||||
test("should validate UTF8SMTP email with umlauts", () => {
|
||||
const result = utf8EmailSchema.safeParse("jörg@example.com");
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
test("should validate UTF8SMTP email with unicode domain", () => {
|
||||
const result = utf8EmailSchema.safeParse("user@münchen.de");
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
test("should validate standard ASCII emails", () => {
|
||||
const result = utf8EmailSchema.safeParse("user@example.com");
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user