Add tests for autofit static endpoints
This commit is contained in:
parent
d8f35bb70a
commit
575c1df524
1 changed files with 21 additions and 1 deletions
|
@ -1,6 +1,9 @@
|
|||
var testStatic = function(prefix, q, format, status, scale, type) {
|
||||
var testStatic = function(prefix, q, format, status, scale, type, query) {
|
||||
if (scale) q += '@' + scale + 'x';
|
||||
var path = '/styles/' + prefix + '/static/' + q + '.' + format;
|
||||
if (query) {
|
||||
path += query;
|
||||
}
|
||||
it(path + ' returns ' + status, function(done) {
|
||||
var test = supertest(app).get(path);
|
||||
if (status) test.expect(status);
|
||||
|
@ -76,4 +79,21 @@ describe('Static endpoints', function() {
|
|||
testStatic('test', '-180,-80,180,80/0.5x2.6', 'png', 404);
|
||||
});
|
||||
});
|
||||
|
||||
describe('autofit path', function() {
|
||||
describe('valid requests', function() {
|
||||
testStatic('test', 'auto/256x256', 'png', 200, undefined, /image\/png/, '?path=10,10|20,20');
|
||||
|
||||
describe('different parameters', function() {
|
||||
testStatic('test', 'auto/20x20', 'png', 200, 2, /image\/png/, '?path=10,10|20,20');
|
||||
testStatic('test', 'auto/200x200', 'png', 200, 3, /image\/png/, '?path=-10,-10|-20,-20');
|
||||
});
|
||||
});
|
||||
|
||||
describe('invalid requests return 4xx', function() {
|
||||
testStatic('test', 'auto/256x256', 'png', 400);
|
||||
testStatic('test', 'auto/256x256', 'png', 400, undefined, undefined, '?path=10,10');
|
||||
testStatic('test', 'auto/2560x2560', 'png', 400, undefined, undefined, '?path=10,10|20,20');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue