From 0a8daf7ee7ac026952a2e1d3d5f25a922dab07cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=88=98=ED=98=84?= Date: Tue, 13 Oct 2026 16:17:00 +0900 Subject: [PATCH] fix(orgchart): resolve package build order and core fixture paths --- package.json | 2 +- packages/org-chart/src/core/expanded-company.test.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7bc53ca..a9969fb 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "build:org-chart-react-example": "vite build --config examples/org-chart-react/vite.config.ts", "dev:org-chart-react-example": "vite --config examples/org-chart-react/vite.config.ts", "test:org-chart-react-browser": "node examples/org-chart-react/verify.mjs", - "build:packages": "npm run build --workspaces --if-present" + "build:packages": "npm run build:org-chart && npm run build:ui && npm run build:center-graphic && npm run build:org-chart-react" }, "dependencies": { "@hm-design/org-chart": "*", diff --git a/packages/org-chart/src/core/expanded-company.test.ts b/packages/org-chart/src/core/expanded-company.test.ts index 6486829..71cc1f2 100644 --- a/packages/org-chart/src/core/expanded-company.test.ts +++ b/packages/org-chart/src/core/expanded-company.test.ts @@ -1,13 +1,15 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import { readFileSync } from 'node:fs'; +import smallFixture from '../../../../examples/org-chart/data-expanded-small.json'; +import mediumFixture from '../../../../examples/org-chart/data-expanded-medium.json'; +import largeFixture from '../../../../examples/org-chart/data-expanded-large.json'; import { validateOrgChartDataset, normalizeOrgChartDataset } from '../data/index.js'; import { resolveExpandedCompanies, validateTopNodes } from './expanded-company.js'; import { createOrgChart } from './index.js'; test('fixed JSON fixtures have exact unique counts, valid ancestry and company memberships', () => { for (const [size, count, companies, depth] of [['small', 20, 3, 2], ['medium', 100, 5, 3], ['large', 300, 7, 4]] as const) { - const input = JSON.parse(readFileSync(`examples/org-chart/data-expanded-${size}.json`, 'utf8')); + const input = structuredClone({ small: smallFixture, medium: mediumFixture, large: largeFixture }[size]); const validation = validateOrgChartDataset(input); assert.equal(validation.valid, true, JSON.stringify(validation)); if (!validation.valid) continue; @@ -28,7 +30,7 @@ test('fixed JSON fixtures have exact unique counts, valid ancestry and company m }); test('inherited identity stays stable; cross-company ancestry fails instead of mixing companies', () => { - const data = JSON.parse(readFileSync('examples/org-chart/data-expanded-small.json', 'utf8')); + const data = structuredClone(smallFixture); delete data.organizations[1].companyId; let roots = normalizeOrgChartDataset(data).roots; assert.equal(resolveExpandedCompanies(data, roots, 'saman').companies.get(data.organizations[1].id), 'hanmac');