Add first batch of tests

This commit is contained in:
Petr Sloup
2016-03-09 11:26:02 +01:00
parent 7ca7fc721f
commit 77755b548b
5 changed files with 79 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
var testTile = function(prefix, z, x, y, format, status, type) {
var path = '/' + prefix + '/' + z + '/' + x + '/' + y + '.' + format;
it(path + ' returns ' + status, function(done) {
var test = supertest(app).get(path);
if (status) test.expect(status);
if (type) test.expect('Content-Type', type);
test.end(done);
});
};
describe('Raster tiles', function() {
describe('existing tiles', function() {
testTile('test', 0, 0, 0, 'png', 200, /image\/png/);
testTile('test', 0, 0, 0, 'jpg', 200, /image\/jpeg/);
testTile('test', 0, 0, 0, 'jpeg', 200, /image\/jpeg/);
testTile('test', 0, 0, 0, 'webp', 200, /image\/webp/);
testTile('test', 1, 1, 1, 'png', 200);
});
describe('error tiles', function() {
testTile('non_existent', 0, 0, 0, 'png', 404);
testTile('test', -1, 0, 0, 'png', 404);
testTile('test', 0, 1, 0, 'png', 404);
testTile('test', 0, 0, 1, 'png', 404);
testTile('test', 0, 0, 1, 'gif', 404);
});
});