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.
20 lines
1.1 KiB
JavaScript
20 lines
1.1 KiB
JavaScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { createPresignForm, buildPresignOrderPayload } from './presign/presign-form-state.js'
|
|
import { buildListParams } from './list-filters.js'
|
|
import { buildPresignListParams } from './presign/presign-list-model.js'
|
|
|
|
test('new presign submits project while editing retains historical display without rewriting assignment', () => {
|
|
const fresh = createPresignForm({ projectId: 'p1', projectName: '项目一', teamName: '项目组' })
|
|
assert.equal(buildPresignOrderPayload(fresh).projectId, 'p1')
|
|
const historical = createPresignForm({ ...fresh, id: 'record' })
|
|
assert.equal(historical.projectName, '项目一')
|
|
assert.equal(historical.teamName, '项目组')
|
|
assert.equal(Object.hasOwn(buildPresignOrderPayload(historical), 'projectId'), false)
|
|
})
|
|
|
|
test('project filters reach both mobile list requests', () => {
|
|
assert.equal(buildListParams('protocol', { source: 'research_donation', projectId: 'p1' }).projectId, 'p1')
|
|
assert.equal(buildPresignListParams({ projectId: 'p1' }).projectId, 'p1')
|
|
})
|