osm-p2p-server
Advanced tools
Comparing version 1.10.1 to 1.10.2
@@ -29,7 +29,7 @@ var parsexml = require('xml-parser') | ||
}) | ||
} else if (ch.name === 'member') { | ||
} else if (ch.name === 'relation') { | ||
doc.members = [] | ||
ch.children.forEach(function (m) { | ||
if (m.name === 'member' && m.attributes.ref) { | ||
doc.members.push(xtend(m.attributes, { type: 'member' })) | ||
doc.members.push(xtend(m.attributes)) | ||
} | ||
@@ -36,0 +36,0 @@ }) |
{ | ||
"name": "osm-p2p-server", | ||
"version": "1.10.1", | ||
"version": "1.10.2", | ||
"description": "serve osm http endpoints over a p2p db", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -60,2 +60,3 @@ var test = require('tape') | ||
var keys = {} | ||
test('add docs to changeset', function (t) { | ||
@@ -68,3 +69,2 @@ var docs = [ | ||
{ id: 'E', type: 'node', lat: 65.3, lon: -120.8, changeset: changeId }, | ||
{ id: 'E', type: 'node', lat: 65.3, lon: -120.8, changeset: changeId }, | ||
{ id: 'F', type: 'node', lat: 60.6, lon: -122.3, changeset: changeId }, | ||
@@ -180,2 +180,82 @@ { id: 'G', type: 'way', refs: ['A','B','C'], changeset: changeId }, | ||
test('get osmchange doc', function (t) { | ||
t.plan(4) | ||
var href = base + 'changeset/' + changeId + '/download' | ||
var hq = hyperquest(href, { | ||
headers: { 'content-type': 'text/xml' } | ||
}) | ||
hq.pipe(concat({ encoding: 'string' }, function (body) { | ||
var xml = parsexml(body) | ||
t.equal(xml.root.name, 'osmChange') | ||
t.equal(xml.root.children.length, 1) | ||
t.equal(xml.root.children[0].name, 'create') | ||
t.deepEqual(chfilter(xml.root.children[0].children).sort(cmpch), [ | ||
{ name: 'node', | ||
attributes: { id: keys.A, changeset: changeId, lat: '64.5', lon: '-121.5' }, | ||
children: [], | ||
content: '' | ||
}, | ||
{ | ||
name: 'node', | ||
attributes: { id: keys.B, changeset: changeId, lat: '63.9', lon: '-120.9' }, | ||
children: [], | ||
content: '' | ||
}, | ||
{ | ||
name: 'node', | ||
attributes: { id: keys.C, changeset: changeId, lat: '64.3', lon: '-122.1' }, | ||
children: [], | ||
content: '' | ||
}, | ||
{ | ||
name: 'node', | ||
attributes: { id: keys.D, changeset: changeId, lat: '65.1', lon: '-120.9' }, | ||
children: [], | ||
content: '' | ||
}, | ||
{ | ||
name: 'node', | ||
attributes: { id: keys.E, changeset: changeId, lat: '65.3', lon: '-120.8' }, | ||
children: [], | ||
content: '' | ||
}, | ||
{ | ||
name: 'node', | ||
attributes: { id: keys.F, changeset: changeId, lat: '60.6', lon: '-122.3' }, | ||
children: [], | ||
content: '' | ||
}, | ||
{ | ||
name: 'way', | ||
attributes: { id: keys.G, changeset: changeId }, | ||
children: [ | ||
{ name: 'nd', attributes: { ref: keys.A }, children: [] }, | ||
{ name: 'nd', attributes: { ref: keys.B }, children: [] }, | ||
{ name: 'nd', attributes: { ref: keys.C }, children: [] } | ||
], | ||
content: '' | ||
}, | ||
{ | ||
name: 'way', | ||
attributes: { id: keys.H, changeset: changeId }, | ||
children: [ | ||
{ name: 'nd', attributes: { ref: keys.D }, children: [] }, | ||
{ name: 'nd', attributes: { ref: keys.E }, children: [] } | ||
], | ||
content: '' | ||
}, | ||
{ | ||
name: 'relation', | ||
attributes: { id: keys.I, changeset: changeId }, | ||
children: [ | ||
{ name: 'member', attributes: { type: 'node', ref: keys.F }, children: [] }, | ||
{ name: 'member', attributes: { type: 'way', ref: keys.G }, children: [] }, | ||
{ name: 'member', attributes: { type: 'way', ref: keys.H }, children: [] } | ||
], | ||
content: '' | ||
}, | ||
].sort(cmpch)) | ||
})) | ||
}) | ||
test('teardown many-types server', function (t) { | ||
@@ -189,1 +269,9 @@ server.close() | ||
} | ||
function chfilter (children) { | ||
children.forEach(function (c) { | ||
chfilter(c.children) | ||
delete c.attributes.version | ||
}) | ||
return children | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73833
21
2310
19