mirror of
https://github.com/maptiler/tileserver-gl.git
synced 2024-11-10 12:44:22 +03:00
69 lines
1.8 KiB
JavaScript
69 lines
1.8 KiB
JavaScript
var testTileJSONArray = function(url) {
|
|
describe(url + ' is array of TileJSONs', function() {
|
|
it('is json', function(done) {
|
|
supertest(app)
|
|
.get(url)
|
|
.expect(200)
|
|
.expect('Content-Type', /application\/json/, done);
|
|
});
|
|
|
|
it('is non-empty array', function(done) {
|
|
supertest(app)
|
|
.get(url)
|
|
.expect(function(res) {
|
|
res.body.should.be.Array();
|
|
res.body.length.should.be.greaterThan(0);
|
|
}).end(done);
|
|
});
|
|
});
|
|
};
|
|
|
|
var testTileJSON = function(url) {
|
|
describe(url + ' is TileJSON', function() {
|
|
it('is json', function(done) {
|
|
supertest(app)
|
|
.get(url)
|
|
.expect(200)
|
|
.expect('Content-Type', /application\/json/, done);
|
|
});
|
|
|
|
it('has valid tiles', function(done) {
|
|
supertest(app)
|
|
.get(url)
|
|
.expect(function(res) {
|
|
res.body.tiles.length.should.be.greaterThan(0);
|
|
}).end(done);
|
|
});
|
|
});
|
|
};
|
|
|
|
describe('Metadata', function() {
|
|
testTileJSONArray('/index.json');
|
|
testTileJSONArray('/rendered.json');
|
|
testTileJSONArray('/data.json');
|
|
|
|
describe('/styles.json is valid array', function() {
|
|
it('is json', function(done) {
|
|
supertest(app)
|
|
.get('/styles.json')
|
|
.expect(200)
|
|
.expect('Content-Type', /application\/json/, done);
|
|
});
|
|
|
|
it('contains valid item', function(done) {
|
|
supertest(app)
|
|
.get('/styles.json')
|
|
.expect(function(res) {
|
|
res.body.should.be.Array();
|
|
res.body.length.should.be.greaterThan(0);
|
|
res.body[0].version.should.equal(8);
|
|
res.body[0].id.should.be.String();
|
|
res.body[0].name.should.be.String();
|
|
}).end(done);
|
|
});
|
|
});
|
|
|
|
testTileJSON('/styles/test-style/rendered.json');
|
|
testTileJSON('/data/openmaptiles.json');
|
|
});
|