From 55f3dbcce54e1c5d323187eaee02f237b97b2b08 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 14 Jan 2025 14:03:59 +0000 Subject: [PATCH] Fix tests. --- packages/server/src/api/routes/tests/row.spec.ts | 9 +++------ packages/server/src/utilities/schema.ts | 6 +----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 737ac2863a..db5fcbaebb 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -2130,13 +2130,10 @@ if (descriptions.length) { ], }, { - // This isn't ideal atm because it doesn't line up with datetime - // and date only error messages, but there's a check earlier in - // the stack than when those errors happen that produces this one, - // and it's not easy to bypass. The key is that this fails. - status: 500, + status: 400, body: { - message: 'Invalid date value: "3pm"', + message: + 'Invalid format for field "time": "3pm". Time-only fields must be in the format "HH:MM:SS".', }, } ) diff --git a/packages/server/src/utilities/schema.ts b/packages/server/src/utilities/schema.ts index 6a30bb5688..b13999c842 100644 --- a/packages/server/src/utilities/schema.ts +++ b/packages/server/src/utilities/schema.ts @@ -175,11 +175,7 @@ export function parse(rows: Rows, table: Table): Rows { if ([FieldType.NUMBER].includes(columnType)) { // If provided must be a valid number parsedRow[columnName] = columnData ? Number(columnData) : columnData - } else if ( - columnType === FieldType.DATETIME && - !columnSchema.timeOnly && - !columnSchema.dateOnly - ) { + } else if (columnType === FieldType.DATETIME) { if (columnData && !columnSchema.timeOnly) { if (!sql.utils.isValidISODateString(columnData)) { let message = `Invalid format for field "${columnName}": "${columnData}".`