Add tenant-scoped teams and projects, order attribution across four businesses, conversion inheritance, scoped statistics and audited reassignment. Reuse existing Web and mobile UI patterns; team regions and hospitals remain informational. Include incremental SQL and isolated regression coverage. Actual MySQL and browser/WebView integration validation remains pending; relates to issue #13.
18 lines
1.1 KiB
JavaScript
18 lines
1.1 KiB
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { projectOptions, projectValidation, projectLabel } from './project-assignment.js'
|
|
|
|
test('only enabled options may be selected, preserving project and team labels', () => {
|
|
assert.deepEqual(projectOptions({ list: [{ id: 'p', projectName: '项目', teamName: '组' }, { id: 'old', disabled: true }] }), [{ value: 'p', text: '项目 · 组' }])
|
|
assert.equal(projectLabel({ projectId: 'old', projectName: '历史停用项目' }), '历史停用项目')
|
|
assert.equal(projectLabel({}), '未归属')
|
|
})
|
|
test('new assignments fail closed during loading or failure and enforce required, edits do not revalidate history', () => {
|
|
assert.match(projectValidation({ loading: true }), /加载/)
|
|
assert.match(projectValidation({ error: '失败' }), /重试/)
|
|
assert.match(projectValidation({ required: true }), /选择/)
|
|
assert.equal(projectValidation({ required: false }), '')
|
|
assert.equal(projectValidation({ editing: true, error: '失败', required: true }), '')
|
|
assert.equal(projectValidation({ required: true, projectId: 'p' }), '')
|
|
})
|