-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.48..v0.2.49 changeset facility.js
Garret Voltz edited this page Oct 2, 2019
·
1 revision
diff --git a/translations/test/facility.js b/translations/test/facility.js
index 024b04f..dcd16e4 100644
--- a/translations/test/facility.js
+++ b/translations/test/facility.js
@@ -1,6 +1,6 @@
var assert = require('assert'),
- xml2js = require('xml2js'),
- DOMParser = new require('xmldom').DOMParser
+ osmtogeojson = require('osmtogeojson'),
+ DOMParser = new require('xmldom').DOMParser,
parser = new DOMParser();
var server = require('../TranslationServer.js');
@@ -12,14 +12,15 @@ describe('TranslationServer', function () {
851: {},
852: {},
857: {}
- }
+ };
var schemas = [
+ 'TDSv70',
'TDSv61',
'TDSv40',
// 'MGCP',
'GGDMv30'
- ]
+ ];
schemas.forEach(schema => {
Object.keys(cases).forEach(k => {
@@ -31,7 +32,11 @@ describe('TranslationServer', function () {
it('should translate Facilities ' + fcode_key + '=AL010 and FFN = ' + code + ' without adding extra FFN2 from ' + schema + ' -> osm -> ' + schema, function() {
- var tds_xml = '<osm version="0.6">\
+ var tds_xml = '<osm version="0.6" upload="true" generator="hootenanny">\
+ <node id="-10" action="modify" visible="true" lat="0.68307256979" lon="18.45073925651" />\
+ <node id="-11" action="modify" visible="true" lat="0.68341620728" lon="18.45091527847" />\
+ <node id="-12" action="modify" visible="true" lat="0.68306209303" lon="18.45157116983" />\
+ <node id="-13" action="modify" visible="true" lat="0.68270797876" lon="18.45141400736" />\
<way id="-19">\
<nd ref="-10" />\
<nd ref="-11" />\
@@ -55,9 +60,6 @@ describe('TranslationServer', function () {
var xml = parser.parseFromString(osm_xml);
assert.equal(xml.getElementsByTagName("osm")[0].getAttribute("schema"), "OSM");
- // assert.equal(xml.getElementsByTagName("tag")[1].getAttribute("k"), "aeroway");
- // assert.equal(xml.getElementsByTagName("tag")[1].getAttribute("v"), "stopway");
-
var tds_xml = server.handleInputs({
osm: osm_xml,
@@ -69,12 +71,14 @@ describe('TranslationServer', function () {
// console.log(tds_xml);
xml = parser.parseFromString(tds_xml);
+ var gj = osmtogeojson(xml);
assert.equal(xml.getElementsByTagName("osm")[0].getAttribute("schema"), schema);
- assert.equal(xml.getElementsByTagName("tag")[1].getAttribute("k"), fcode_key);
- assert.equal(xml.getElementsByTagName("tag")[1].getAttribute("v"), "AL010");
- assert.equal(xml.getElementsByTagName("tag")[0].getAttribute("k"), "FFN");
- assert.equal(xml.getElementsByTagName("tag")[0].getAttribute("v"), code);
+
+ var tags = gj.features[0].properties;
+
+ assert.equal(tags[fcode_key], 'AL010');
+ assert.equal(tags['FFN'], code);
});
});