feat(admin): apply shared blue-white self-operated workbench style
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { RequestFence, RetryIntent, RuntimePoller, contextParams, label, reasonsText, progressText, sameContext, shownQuantity, taskRetryAllowed, validateCustomRange } from './state'
|
||||
import { RequestFence, RetryIntent, RuntimePoller, contextParams, groupedQuantityText, label, quantityText, reasonsText, progressText, sameContext, shownQuantity, taskRetryAllowed, validateCustomRange } from './state'
|
||||
import type { QueryContext, Task } from './types'
|
||||
|
||||
const context: QueryContext = { salesRunId: '9007199254740999', inventoryRunId: null, salesScopeHash: 'sales', inventoryScopeHash: null, queryAsOf: '2026-10-12T15:00:00+08:00', queryExpiresAt: '2026-10-12T15:30:00+08:00', businessTimezone: 'Asia/Shanghai', anchorDate: '2026-10-12' }
|
||||
@@ -36,6 +36,23 @@ describe('self-operated query and command protection', () => {
|
||||
expect(shownQuantity({ outboundQuantity: null, observedQuantity: null, dataStatus: 'UNKNOWN' })).toBeNull()
|
||||
expect(shownQuantity({ outboundQuantity: '0', observedQuantity: '0', dataStatus: 'COMPLETE' })).toBe('0')
|
||||
})
|
||||
it('groups quantities without losing long integers, decimal digits or the original formatter semantics', () => {
|
||||
const cases: Array<[string | number | null | undefined, string]> = [
|
||||
['123456789012345678901234567890.123450000001', '123,456,789,012,345,678,901,234,567,890.123450000001'],
|
||||
['9007199254740993', '9,007,199,254,740,993'],
|
||||
['-1234567.000100', '-1,234,567.000100'],
|
||||
[1234567.125, '1,234,567.125'],
|
||||
['0.000000000001', '0.000000000001'],
|
||||
['0', '0'],
|
||||
[0, '0'],
|
||||
[null, '—'],
|
||||
[undefined, '—'],
|
||||
]
|
||||
for (const [value, expected] of cases) {
|
||||
expect(groupedQuantityText(value)).toBe(expected)
|
||||
expect(quantityText(value)).toBe(value == null ? '—' : String(value))
|
||||
}
|
||||
})
|
||||
it('requires permission, server eligibility, correct warehouse and reason for retry', () => {
|
||||
const scope = { sourceAccount: 'lingxing-primary', warehouseCode: 'WH-A' }
|
||||
expect(taskRetryAllowed(task, true, scope, '修复后恢复')).toBe(true)
|
||||
|
||||
Reference in New Issue
Block a user