Skip to content

Commit b31f3eb

Browse files
committed
tests(firestore-send-email): refactor tests
1 parent 80265a4 commit b31f3eb

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

firestore-send-email/functions/src/validation.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,8 @@ function formatZodError(
185185
const path = issue.path.length > 0 ? issue.path.join(".") : context;
186186
switch (issue.code) {
187187
case "invalid_type":
188-
if (issue.message && !issue.message.startsWith("Expected")) {
189-
const customMessage = issue.message.replace(
190-
/Field 'attachments'/g,
191-
`Field '${path}'`
192-
);
193-
return customMessage;
188+
if (issue.received === "undefined") {
189+
return `Field '${path}' must be a ${issue.expected}`;
194190
}
195191

196192
if (issue.expected === "string") {

0 commit comments

Comments
 (0)