feat: 重建 Sense 区域与警戒线配置 (#69)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { buildAreaPayload, validateAreaForm } from '@/views/sense/area/areaPayload'
|
||||
|
||||
describe('Sense area payload', () => {
|
||||
it('keeps the optimistic version and normalized geometry', () => {
|
||||
const form = { name: ' 东门警戒线 ', kind: 'direction_line', routeId: 'device-1:main', points: [{ x: '0.2', y: '0.5' }, { x: '0.8', y: '0.5' }], direction: 'reverse', enabled: true, version: 4 }
|
||||
expect(validateAreaForm(form)).toBe('')
|
||||
expect(buildAreaPayload(form)).toEqual({ name: '东门警戒线', kind: 'direction_line', routeId: 'device-1:main', points: [{ x: 0.2, y: 0.5 }, { x: 0.8, y: 0.5 }], direction: 'reverse', enabled: true, expectedVersion: 4 })
|
||||
})
|
||||
|
||||
it('rejects incomplete geometry before sending', () => {
|
||||
expect(validateAreaForm({ name: '危险区域', kind: 'polygon', routeId: 'route-1', points: [] })).toContain('3 到 64')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user