fix(orgchart): resolve package build order and core fixture paths

This commit is contained in:
shkim4 committed 2026-10-13 16:17:00 +09:00
1 parent b637f86631
commit 0a8daf7ee7
2 files changed
+6 -4

No files matched your search

+1 -1
View File
@@ -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": "*",
@@ -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');