From f5d838da68273050555d42d2796f5398a4001fc9 Mon Sep 17 00:00:00 2001 From: MIckLesk Date: Tue, 11 Mar 2025 16:35:41 +0100 Subject: [PATCH 1/4] Correct symbolic link --- frontend/public/json | 1 + 1 file changed, 1 insertion(+) create mode 120000 frontend/public/json diff --git a/frontend/public/json b/frontend/public/json new file mode 120000 index 000000000..cd8045684 --- /dev/null +++ b/frontend/public/json @@ -0,0 +1 @@ +../../json \ No newline at end of file From 49b524464ee594e550f85535e9b809c40edab593 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:39:25 +0100 Subject: [PATCH 2/4] Update frontend-cicd.yml --- .github/workflows/frontend-cicd.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/frontend-cicd.yml b/.github/workflows/frontend-cicd.yml index 0391a3987..c4f1a6418 100644 --- a/.github/workflows/frontend-cicd.yml +++ b/.github/workflows/frontend-cicd.yml @@ -27,7 +27,7 @@ concurrency: jobs: build: - runs-on: ubuntu-latest + runs-on: runner-cluster-htl-set defaults: run: working-directory: frontend # Set default working directory for all run steps @@ -45,6 +45,9 @@ jobs: - name: Install dependencies run: npm ci --prefer-offline --legacy-peer-deps + - name: Run tests + run: npm run test + - name: Configure Next.js for pages uses: actions/configure-pages@v5 with: From da16da149642213b6fee56af06b4d7f0dfb64f7e Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:41:26 +0100 Subject: [PATCH 3/4] Update frontend-cicd.yml --- .github/workflows/frontend-cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-cicd.yml b/.github/workflows/frontend-cicd.yml index c4f1a6418..dd242f6ef 100644 --- a/.github/workflows/frontend-cicd.yml +++ b/.github/workflows/frontend-cicd.yml @@ -27,7 +27,7 @@ concurrency: jobs: build: - runs-on: runner-cluster-htl-set + runs-on: ubuntu-latest defaults: run: working-directory: frontend # Set default working directory for all run steps From 23add3314519c5ff850a1857053d7e4db4f1a47f Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:44:54 +0100 Subject: [PATCH 4/4] Update validate-json.test.ts --- .../__tests__/public/validate-json.test.ts | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/frontend/src/__tests__/public/validate-json.test.ts b/frontend/src/__tests__/public/validate-json.test.ts index ab73292a4..562ebe9c1 100644 --- a/frontend/src/__tests__/public/validate-json.test.ts +++ b/frontend/src/__tests__/public/validate-json.test.ts @@ -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"; @@ -25,7 +15,7 @@ describe.each(fileNames)("%s", async (fileName) => { let script: Script; beforeAll(async () => { - const filePath = path.resolve(jsonDir, fileName); + const filePath = path.resolve(jsonDir, fileName); const fileContent = await fs.readFile(filePath, encoding) script = JSON.parse(fileContent); }) @@ -46,7 +36,7 @@ describe(`${metadataFileName}`, async () => { let metadata: Metadata; beforeAll(async () => { - const filePath = path.resolve(jsonDir, metadataFileName); + const filePath = path.resolve(jsonDir, metadataFileName); const fileContent = await fs.readFile(filePath, encoding) metadata = JSON.parse(fileContent); }) @@ -55,9 +45,9 @@ describe(`${metadataFileName}`, async () => { // TODO: create zod schema for metadata. Move zod schemas to /lib/types.ts assert(metadata.categories.length > 0); metadata.categories.forEach((category) => { - assert.isString(category.name) - assert.isNumber(category.id) - assert.isNumber(category.sort_order) + assert.isString(category.name) + assert.isNumber(category.id) + assert.isNumber(category.sort_order) }); }); })