feat(qa-ops): 支持自定义区域与分级部门批量归属
build / build (push) Successful in 1m8s

This commit is contained in:
姚章浩
2026-10-18 21:50:29 +08:00
parent 8835a473dd
commit 76671e0784
33 changed files with 865 additions and 100 deletions
+29
View File
@@ -30,6 +30,35 @@ export const directoryFixture = {
},
}
describe('department region configuration', () => {
it('uses configurable stable region IDs rather than a four-name whitelist', () => {
const catalog = [
{ id: 'education', name: '国内教育' },
{ id: 'west', name: '国外工业Amercia' },
]
const state = parseOrganization({
...directoryFixture,
regions: catalog,
rules: [{ department_id: 'root', region: 'education' }],
view: {
...directoryFixture.view,
departments: [{ ...directoryFixture.view.departments[0], region: 'education', explicit: true }],
regions: { education: 1, west: 0 },
unassigned_people: 0,
},
})
expect(state.regions).toEqual(catalog)
expect(state.rules[0].region).toBe('education')
expect(state.view.regions.education).toBe(1)
})
it('rejects undeclared region counts rather than silently dropping them', () => {
expect(() =>
parseOrganization({
...directoryFixture,
view: { ...directoryFixture.view, regions: { ...directoryFixture.view.regions, undeclared: 0 } },
})
).toThrow()
})
it('parses an honest dated snapshot without exposing employee identities', () => {
const state = parseOrganization(directoryFixture)
expect(state.directory_source).toBe('weekly_report_snapshot')