Fix test flake.

This commit is contained in:
Sam Rose 2025-03-03 11:27:38 +00:00
parent 9df9f2bac7
commit 110de112c4
No known key found for this signature in database
2 changed files with 3 additions and 17 deletions

View File

@ -26,7 +26,7 @@ export function csv(
headers.map(header => {
const val = row[header]
if (typeof val === "object" && !(val instanceof Date)) {
return `"${JSON.stringify(val).replace(/"/g, "'")}"`
return `"${escapeCsvString(JSON.stringify(val))}"`
}
if (val !== undefined) {
return `"${escapeCsvString(val.toString())}"`

View File

@ -270,20 +270,6 @@ function parseJsonExport<T>(value: any) {
if (typeof value !== "string") {
return value
}
try {
const parsed = JSON.parse(value)
return parsed as T
} catch (e: any) {
if (
e.message.startsWith("Expected property name or '}' in JSON at position ")
) {
// This was probably converted as CSV and it has single quotes instead of double ones
const parsed = JSON.parse(value.replace(/'/g, '"'))
return parsed as T
}
// It is no a valid JSON
throw e
}
}