feat: 建立 Sense 可靠投递状态机 (#78)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
buildOutboxQuery,
|
||||
nextAction,
|
||||
stateLabel,
|
||||
stateType,
|
||||
typeLabel
|
||||
} from '@/views/sense/outbox/outboxState'
|
||||
|
||||
describe('Sense outbox presentation state', () => {
|
||||
test('uses operator-facing labels and non-color-only states', () => {
|
||||
expect(stateLabel('dead')).toBe('死信')
|
||||
expect(stateType('dead')).toBe('danger')
|
||||
expect(typeLabel('local_event_candidate')).toBe('本地事件候选')
|
||||
})
|
||||
test('builds an allowlisted trimmed query', () => {
|
||||
expect(
|
||||
buildOutboxQuery({
|
||||
pageIndex: 2,
|
||||
pageSize: 20,
|
||||
state: 'retry',
|
||||
internalType: 'local_event_candidate',
|
||||
keyword: ' key ',
|
||||
ignored: 'no'
|
||||
})
|
||||
).toEqual({
|
||||
pageIndex: 2,
|
||||
pageSize: 20,
|
||||
state: 'retry',
|
||||
internalType: 'local_event_candidate',
|
||||
keyword: 'key'
|
||||
})
|
||||
})
|
||||
test('explains the next recovery action', () => {
|
||||
expect(nextAction({ state: 'dead' })).toBe('等待人工处理')
|
||||
expect(nextAction({ state: 'pending' })).toBe('等待 worker 领取')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user