This commit is contained in:
huangyingjie 2016-12-08 10:38:40 +00:00 committed by GitHub
commit be8fa6744e
2 changed files with 11 additions and 7 deletions

View file

@ -149,8 +149,13 @@ module.exports = function(options, repo, params, id, styles) {
app.get('/' + id + '.json', function(req, res, next) { app.get('/' + id + '.json', function(req, res, next) {
var info = clone(tileJSON); var info = clone(tileJSON);
info.tiles = utils.getTileUrls(req, info.tiles, info.tiles = utils.getTileUrls(req, info.tiles, 'data/' + id, info.format);
'data/' + id, info.format); // delete usless info
delete info.Layer;
delete info.id;
delete info.filesize;
delete info.basename;
delete info.mtime;
return res.send(info); return res.send(info);
}); });

View file

@ -18,7 +18,7 @@ var testTileJSONArray = function(url) {
}); });
}; };
var testTileJSON = function(url, basename) { var testTileJSON = function(url) {
describe(url + ' is TileJSON', function() { describe(url + ' is TileJSON', function() {
it('is json', function(done) { it('is json', function(done) {
supertest(app) supertest(app)
@ -27,11 +27,10 @@ var testTileJSON = function(url, basename) {
.expect('Content-Type', /application\/json/, done); .expect('Content-Type', /application\/json/, done);
}); });
it('has valid basename and tiles', function(done) { it('has valid tiles', function(done) {
supertest(app) supertest(app)
.get(url) .get(url)
.expect(function(res) { .expect(function(res) {
res.body.basename.should.equal(basename);
res.body.tiles.length.should.be.greaterThan(0); res.body.tiles.length.should.be.greaterThan(0);
}).end(done); }).end(done);
}); });
@ -64,6 +63,6 @@ describe('Metadata', function() {
}); });
}); });
testTileJSON('/styles/bright/rendered.json', 'bright'); testTileJSON('/styles/bright/rendered.json');
testTileJSON('/data/zurich-vector.json', 'zurich-vector'); testTileJSON('/data/zurich-vector.json');
}); });