| 123456789101112 |
- import assert from 'node:assert/strict'
- import { toPipeNetwork } from '../../../src/modules/cockpit/domain/pipeNetwork.js'
- import { pipeColorKey } from '../../../src/modules/cockpit/domain/pipeVisual.js'
- const response=await fetch('http://192.168.110.96:8301/api/cockpit/v1/infrastructure/geometry')
- const body=await response.json();assert.equal(response.status,200);assert.equal(body.code,200)
- const drainage=toPipeNetwork(body.data).pipes.filter(p=>p.industry==='DRAINAGE')
- assert.ok(drainage.length>0)
- assert.ok(drainage.every(p=>p.networkLevel===0),'legacy live response defaults to sewage')
- assert.ok(drainage.every(p=>pipeColorKey(p)==='SEWAGE'))
- const syntheticRain=toPipeNetwork({features:[{geometry:{type:'LineString',coordinates:[[110.39,28.44],[110.3901,28.44]]},properties:{code:'live-contract-1',industry:'DRAINAGE',networkLevel:1,coordinateValidation:{renderable:true}}}]})
- assert.equal(pipeColorKey(syntheticRain.pipes[0]),'RAINWATER')
- console.log(JSON.stringify({liveDrainage:drainage.length,liveNetworkLevelKeys:drainage.filter(p=>p.networkLevel!==0).length,legacyColor:'SEWAGE',syntheticLevel1Color:'RAINWATER'}))
|