Update validate-json.test.ts

This commit is contained in:
CanbiZ 2025-03-11 16:44:54 +01:00 committed by GitHub
parent da16da1496
commit 23add33145
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,17 +4,7 @@ import path from "path";
import { ScriptSchema, type Script } from "@/app/json-editor/_schemas/schemas";
import { Metadata } from "@/lib/types";
const publicJsonPath = path.join(process.cwd(), 'public/json');
const getJsonDirectory = async () => {
if (!(await fs.stat(publicJsonPath).catch(() => null))) {
throw new Error(`JSON path file not found: ${publicJsonPath}`);
}
const jsonPath = (await fs.readFile(publicJsonPath, "utf-8")).trim();
return path.resolve(process.cwd(), jsonPath);
};
const jsonDir = await getJsonDirectory();
const jsonDir = "public/json";
const metadataFileName = "metadata.json";
const encoding = "utf-8";