fix: use live V2X vehicles only in preview
This commit is contained in:
@@ -15,7 +15,7 @@ const context = {
|
||||
};
|
||||
vm.runInNewContext(source, context, { filename: "v2x-cesium-overlay.js" });
|
||||
|
||||
const { gcj02ToWgs84, joinUrl, md5, toWebSocketUrl } = context.window.createV2xCesiumOverlay.utils;
|
||||
const { gcj02ToWgs84, joinUrl, md5, toWebSocketUrl, normalizeObuVehicle, normalizeTargetVehicles } = context.window.createV2xCesiumOverlay.utils;
|
||||
assert.equal(md5(""), "d41d8cd98f00b204e9800998ecf8427e");
|
||||
assert.equal(md5("password"), "5f4dcc3b5aa765d61d8327deb882cf99");
|
||||
assert.equal(joinUrl("/api/", "/facilities/api/sys/login"), "/api/facilities/api/sys/login");
|
||||
@@ -27,5 +27,12 @@ const reference = referenceGcj02ToWgs84([114.12864875054062, 30.460485279762146]
|
||||
assert.ok(Math.abs(converted[0] - reference[0]) < 1e-12);
|
||||
assert.ok(Math.abs(converted[1] - reference[1]) < 1e-12);
|
||||
assert.deepEqual(gcj02ToWgs84([Infinity, 30]), [NaN, NaN]);
|
||||
assert.deepEqual(normalizeObuVehicle(JSON.stringify({ carCode: "car-7", plateNumber: "A12345", lon: 114.12865, lat: 30.46049, angle: 90, speed: 12 })), {
|
||||
id: "obu-car-7", label: "A12345", kind: "obu", longitude: 114.12865, latitude: 30.46049, angle: 90, speed: 12,
|
||||
});
|
||||
assert.deepEqual(normalizeTargetVehicles(JSON.stringify({ data: { "8": [{ id: 9, longitude: 114.12866, latitude: 30.4605, type: 1, subType: 2, angle: 180, speed: 5 }] } })), [{
|
||||
id: "8-9-12", label: "8-9", kind: "target", longitude: 114.12866, latitude: 30.4605, angle: 180, speed: 5,
|
||||
}]);
|
||||
assert.equal(normalizeObuVehicle('{bad json'), null);
|
||||
|
||||
console.log("V2X Cesium overlay tests passed.");
|
||||
|
||||
Reference in New Issue
Block a user