More tests for the endpoints
This commit is contained in:
28
test/tiles_vector.js
Normal file
28
test/tiles_vector.js
Normal file
@@ -0,0 +1,28 @@
|
||||
var testTile = function(prefix, z, x, y, status) {
|
||||
var path = '/' + prefix + '/' + z + '/' + x + '/' + y + '.pbf';
|
||||
it(path + ' returns ' + status, function(done) {
|
||||
var test = supertest(app).get(path);
|
||||
if (status) test.expect(status);
|
||||
if (status == 200) test.expect('Content-Type', /application\/x-protobuf/);
|
||||
test.end(done);
|
||||
});
|
||||
};
|
||||
|
||||
var prefix = 'zurich-vector';
|
||||
|
||||
describe('Vector tiles', function() {
|
||||
describe('existing tiles', function() {
|
||||
testTile(prefix, 0, 0, 0, 200);
|
||||
testTile(prefix, 14, 8581, 5738, 200);
|
||||
});
|
||||
|
||||
describe('error tiles', function() {
|
||||
testTile('non_existent', 0, 0, 0, 404);
|
||||
testTile(prefix, -1, 0, 0, 404); // err zoom
|
||||
testTile(prefix, 20, 0, 0, 404); // zoom out of bounds
|
||||
testTile(prefix, 0, 1, 0, 404);
|
||||
testTile(prefix, 0, 0, 1, 404);
|
||||
|
||||
testTile(prefix, 14, 0, 0, 404); // non existent tile
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user