Update and add tests
This commit is contained in:
+40
-8
@@ -1,37 +1,69 @@
|
||||
describe('Metadata', function() {
|
||||
describe('/index.json', function() {
|
||||
var testTileJSONArray = function(url) {
|
||||
describe(url + ' is array of TileJSONs', function() {
|
||||
it('is json', function(done) {
|
||||
supertest(app)
|
||||
.get('/index.json')
|
||||
.get(url)
|
||||
.expect(200)
|
||||
.expect('Content-Type', /application\/json/, done);
|
||||
});
|
||||
|
||||
it('is non-empty array', function(done) {
|
||||
supertest(app)
|
||||
.get('/index.json')
|
||||
.get(url)
|
||||
.expect(function(res) {
|
||||
res.body.should.be.Array();
|
||||
res.body.length.should.be.greaterThan(0);
|
||||
}).end(done);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
describe('/test.json', function() {
|
||||
var testTileJSON = function(url, basename) {
|
||||
describe(url + ' is TileJSON', function() {
|
||||
it('is json', function(done) {
|
||||
supertest(app)
|
||||
.get('/test.json')
|
||||
.get(url)
|
||||
.expect(200)
|
||||
.expect('Content-Type', /application\/json/, done);
|
||||
});
|
||||
|
||||
it('has valid basename and tiles', function(done) {
|
||||
supertest(app)
|
||||
.get('/test.json')
|
||||
.get(url)
|
||||
.expect(function(res) {
|
||||
res.body.basename.should.equal('test');
|
||||
res.body.basename.should.equal(basename);
|
||||
res.body.tiles.length.should.be.greaterThan(0);
|
||||
}).end(done);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
describe('Metadata', function() {
|
||||
testTileJSONArray('/index.json');
|
||||
testTileJSONArray('/raster.json');
|
||||
testTileJSONArray('/vector.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('/raster/test.json', 'test');
|
||||
testTileJSON('/vector/zurich-vector.json', 'zurich-vector');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user