From 6cf5730bcb70a9c8bda2f0373d3d66f03cfca5e2 Mon Sep 17 00:00:00 2001 From: Patrik Date: Wed, 20 Mar 2024 14:21:58 -0400 Subject: [PATCH] test: passing json fields test suite (#5389) * test: passing json fields test suite * test: actually gets json tests to pass --- packages/ui/src/fields/JSON/index.tsx | 2 +- test/fields/seed.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/fields/JSON/index.tsx b/packages/ui/src/fields/JSON/index.tsx index a1b7a67a0f..57ca4e4942 100644 --- a/packages/ui/src/fields/JSON/index.tsx +++ b/packages/ui/src/fields/JSON/index.tsx @@ -74,7 +74,7 @@ const JSONFieldComponent: React.FC = (props) => { setStringValue(val) try { - setValue(val ? JSON.stringify(JSON.parse(val)) : null) + setValue(val ? JSON.parse(val) : null) setJsonError(undefined) } catch (e) { setValue(val ? val : null) diff --git a/test/fields/seed.ts b/test/fields/seed.ts index 642b26c6c3..15c00833fd 100644 --- a/test/fields/seed.ts +++ b/test/fields/seed.ts @@ -53,8 +53,8 @@ export async function clearAndSeedEverything(_payload: Payload) { _payload, collectionSlugs, seedFunction: async (_payload) => { - const jpgPath = path.resolve(process.cwd(), './test/fields/collections/Upload/payload.jpg') - const pngPath = path.resolve(process.cwd(), './test/fields/uploads/payload.png') + const jpgPath = path.resolve(dirname, './collections/Upload/payload.jpg') + const pngPath = path.resolve(dirname, './uploads/payload.png') // Get both files in parallel const [jpgFile, pngFile] = await Promise.all([getFileByPath(jpgPath), getFileByPath(pngPath)])