feat(self-operated): unify completed-day ranges and analytics sorting
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { RequestFence, RetryIntent, RuntimePoller, contextParams, progressText, sameContext, shownQuantity, taskRetryAllowed, validateCustomRange } from './state'
|
||||
import { RequestFence, RetryIntent, RuntimePoller, contextParams, label, 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' }
|
||||
const task: Task = { taskNo: 'COL-TEST-001', warehouseCode: 'WH-A', taskType: 'BACKFILL', dataFamily: 'OUTBOUND', taskStatus: 'FAILED', applyState: 'BLOCKED', attemptCount: 1, latestAttemptNo: 1, resultPublicationState: 'NOT_PUBLISHED', nextRetryAt: null, allowedActions: ['RETRY'], actionBlockReason: null, progress: null, queryFrom: null, queryUntil: null }
|
||||
describe('self-operated query and command protection', () => {
|
||||
it('explains pending publication and unfinished days instead of a generic unknown reason', () => {
|
||||
expect(label('REBUILD_REQUIRED')).toBe('销量待重新统计发布')
|
||||
expect(reasonsText(['SALES_REBUILD_REQUIRED', 'TODAY_INCOMPLETE', 'SALES_SOURCE_TIMEZONE_UNKNOWN'])).toBe('销量有变动,待重新统计发布、今日尚未结束,不能作为完整自然日、销量来源时区未确认')
|
||||
})
|
||||
it('aborts old warehouse request and rejects late completion even if adapter ignores abort', () => {
|
||||
const fence = new RequestFence()
|
||||
const oldWarehouse = fence.begin()
|
||||
|
||||
Reference in New Issue
Block a user