mirror of
https://github.com/maptiler/tileserver-gl.git
synced 2024-09-11 12:05:41 +03:00
Add more tests + better structuring
This commit is contained in:
parent
a0007b42f9
commit
9efa22b52b
@ -11,21 +11,25 @@ var testStatic = function(prefix, q, format, status, scale, type) {
|
||||
|
||||
describe('Static endpoints', function() {
|
||||
describe('center-based', function() {
|
||||
describe('Valid requests', function() {
|
||||
testStatic('test', '0,0,0/256x256', 'png', 200, undefined, /image\/png/);
|
||||
testStatic('test', '0,0,0/256x256', 'jpg', 200, undefined, /image\/jpeg/);
|
||||
testStatic('test', '0,0,0/256x256', 'jpeg', 200, undefined, /image\/jpeg/);
|
||||
testStatic('test', '0,0,0/256x256', 'webp', 200, undefined, /image\/webp/);
|
||||
describe('valid requests', function() {
|
||||
describe('various formats', function() {
|
||||
testStatic('test', '0,0,0/256x256', 'png', 200, undefined, /image\/png/);
|
||||
testStatic('test', '0,0,0/256x256', 'jpg', 200, undefined, /image\/jpeg/);
|
||||
testStatic('test', '0,0,0/256x256', 'jpeg', 200, undefined, /image\/jpeg/);
|
||||
testStatic('test', '0,0,0/256x256', 'webp', 200, undefined, /image\/webp/);
|
||||
});
|
||||
|
||||
testStatic('test', '0,0,0/300x300', 'png', 200, 2);
|
||||
testStatic('test', '0,0,0/300x300', 'png', 200, 3);
|
||||
describe('different parameters', function() {
|
||||
testStatic('test', '0,0,0/300x300', 'png', 200, 2);
|
||||
testStatic('test', '0,0,0/300x300', 'png', 200, 3);
|
||||
|
||||
testStatic('test', '80,40,20/600x300', 'png', 200, 3);
|
||||
testStatic('test', '8.5,40.5,20/300x150', 'png', 200, 3);
|
||||
testStatic('test', '-8.5,-40.5,20/300x150', 'png', 200, 3);
|
||||
testStatic('test', '80,40,20/600x300', 'png', 200, 3);
|
||||
testStatic('test', '8.5,40.5,20/300x150', 'png', 200, 3);
|
||||
testStatic('test', '-8.5,-40.5,20/300x150', 'png', 200, 3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Invalid requests', function() {
|
||||
describe('invalid requests return 4xx', function() {
|
||||
testStatic('test', '190,0,0/256x256', 'png', 400);
|
||||
testStatic('test', '0,86,0/256x256', 'png', 400);
|
||||
testStatic('test', '80,40,20/0x0', 'png', 400);
|
||||
@ -37,4 +41,31 @@ describe('Static endpoints', function() {
|
||||
testStatic('test', '0,0,0/256.5x256.5', 'png', 404);
|
||||
});
|
||||
});
|
||||
|
||||
describe('area-based', function() {
|
||||
describe('valid requests', function() {
|
||||
describe('various formats', function() {
|
||||
testStatic('test', '-180,-80,180,80/0', 'png', 200, undefined, /image\/png/);
|
||||
testStatic('test', '-180,-80,180,80/0', 'jpg', 200, undefined, /image\/jpeg/);
|
||||
testStatic('test', '-180,-80,180,80/0', 'jpeg', 200, undefined, /image\/jpeg/);
|
||||
testStatic('test', '-180,-80,180,80/0', 'webp', 200, undefined, /image\/webp/);
|
||||
});
|
||||
|
||||
describe('different parameters', function() {
|
||||
testStatic('test', '-180,-90,180,90/0', 'png', 200, 2);
|
||||
testStatic('test', '0,0,1,1/3', 'png', 200, 3);
|
||||
|
||||
testStatic('test', '-280,-80,0,80/0', 'png', 200);
|
||||
});
|
||||
});
|
||||
|
||||
describe('invalid requests return 4xx', function() {
|
||||
testStatic('test', '0,87,1,88/5', 'png', 400);
|
||||
|
||||
testStatic('test', '18,-9,-18,9/0', 'png', 400);
|
||||
testStatic('test', '0,0,1,1/1', 'gif', 400);
|
||||
|
||||
testStatic('test', '-180,-80,180,80/0.5', 'png', 404);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -10,20 +10,24 @@ var testTile = function(prefix, z, x, y, format, status, scale, type) {
|
||||
};
|
||||
|
||||
describe('Raster tiles', function() {
|
||||
describe('existing tiles', function() {
|
||||
testTile('test', 0, 0, 0, 'png', 200, undefined, /image\/png/);
|
||||
testTile('test', 0, 0, 0, 'jpg', 200, undefined, /image\/jpeg/);
|
||||
testTile('test', 0, 0, 0, 'jpeg', 200, undefined, /image\/jpeg/);
|
||||
testTile('test', 0, 0, 0, 'webp', 200, undefined, /image\/webp/);
|
||||
describe('valid requests', function() {
|
||||
describe('various formats', function() {
|
||||
testTile('test', 0, 0, 0, 'png', 200, undefined, /image\/png/);
|
||||
testTile('test', 0, 0, 0, 'jpg', 200, undefined, /image\/jpeg/);
|
||||
testTile('test', 0, 0, 0, 'jpeg', 200, undefined, /image\/jpeg/);
|
||||
testTile('test', 0, 0, 0, 'webp', 200, undefined, /image\/webp/);
|
||||
});
|
||||
|
||||
testTile('test', 1, 1, 1, 'png', 200);
|
||||
describe('different coordinates and scales', function() {
|
||||
testTile('test', 1, 1, 1, 'png', 200);
|
||||
|
||||
testTile('test', 0, 0, 0, 'png', 200, 2);
|
||||
testTile('test', 0, 0, 0, 'png', 200, 3);
|
||||
testTile('test', 2, 1, 1, 'png', 200, 3);
|
||||
testTile('test', 0, 0, 0, 'png', 200, 2);
|
||||
testTile('test', 0, 0, 0, 'png', 200, 3);
|
||||
testTile('test', 2, 1, 1, 'png', 200, 3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('error tiles', function() {
|
||||
describe('invalid requests return 4xx', function() {
|
||||
testTile('non_existent', 0, 0, 0, 'png', 404);
|
||||
testTile('test', -1, 0, 0, 'png', 404);
|
||||
testTile('test', 25, 0, 0, 'png', 404);
|
||||
|
@ -16,7 +16,7 @@ describe('Vector tiles', function() {
|
||||
testTile(prefix, 14, 8581, 5738, 200);
|
||||
});
|
||||
|
||||
describe('error tiles', function() {
|
||||
describe('non-existent requests return 4xx', 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
|
||||
|
Loading…
Reference in New Issue
Block a user