Skip to content

Commit

Permalink
Merge pull request #44 from mapbox/038-fix-namespace
Browse files Browse the repository at this point in the history
Fix source namespace
  • Loading branch information
defvol authored Jun 28, 2016
2 parents 470ab9c + a7b8042 commit 5816b56
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mbview.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
console.log(data);
}
// Save reference to tiles
tilesets[data.name] = tiles;
tilesets[data.basename] = tiles;
// Extends the configuration object with new parameters found
config = objectAssign({}, config, utils.metadata(data));
// d3-queue.defer pattern to return the result of the task
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mbview",
"version": "1.5.1",
"version": "1.6.0",
"description": "Watch mbtiles in your localhost",
"bin": {
"mbview": "./cli.js"
Expand Down
Binary file added test/fixtures/038.mbtiles
Binary file not shown.
15 changes: 12 additions & 3 deletions test/mbview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ test('MBView.loadTiles', function (t) {
});

test('MBView.serve', function (t) {
t.plan(7);
t.plan(8);

var params = {
basemap: 'dark',
mbtiles: [
__dirname + '/../examples/baja-highways.mbtiles',
__dirname + '/fixtures/twolayers.mbtiles'
__dirname + '/fixtures/twolayers.mbtiles',
__dirname + '/fixtures/038.mbtiles'
],
port: 9000
};
Expand Down Expand Up @@ -68,7 +69,15 @@ test('MBView.serve', function (t) {
.get('/baja-highways.mbtiles/14/2864/6624.pbf')
.expect('Content-Type', 'application/x-protobuf')
.end(function (err) {
t.error(err, 'serves protobufs');
t.error(err, 'serves protobufs for ' + source);
});

var source = Object.keys(config.sources)[2];
request('localhost:9000')
.get('/' + source + '/14/2864/6624.pbf')
.expect(200)
.end(function (err) {
t.error(err, 'serves protobufs for ' + source);
});
});
});
Expand Down
1 change: 1 addition & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var fixtures = {

function mockMetadata (name) {
return objectAssign({}, fixtures.metadata, {
basename: name + '.mbtiles',
name: name + '.mbtiles',
vector_layers: [{ id: name }]
});
Expand Down
2 changes: 1 addition & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports.metadata = function (data) {
center: meta.center,
sources: {}
};
res.sources[meta.name] = { layers: meta.vector_layers };
res.sources[meta.basename] = { layers: meta.vector_layers };
return res;
};

Expand Down

0 comments on commit 5816b56

Please sign in to comment.