tileserver-gl-light 4.1.2 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/utils.js CHANGED
@@ -6,8 +6,8 @@ import fs from 'node:fs';
6
6
  import clone from 'clone';
7
7
  import glyphCompose from '@mapbox/glyph-pbf-composite';
8
8
 
9
-
10
- export const getPublicUrl = (publicUrl, req) => publicUrl || `${req.protocol}://${req.headers.host}/`;
9
+ export const getPublicUrl = (publicUrl, req) =>
10
+ publicUrl || `${req.protocol}://${req.headers.host}/`;
11
11
 
12
12
  export const getTileUrls = (req, domains, path, format, publicUrl, aliases) => {
13
13
  if (domains) {
@@ -16,7 +16,8 @@ export const getTileUrls = (req, domains, path, format, publicUrl, aliases) => {
16
16
  }
17
17
  const host = req.headers.host;
18
18
  const hostParts = host.split('.');
19
- const relativeSubdomainsUsable = hostParts.length > 1 &&
19
+ const relativeSubdomainsUsable =
20
+ hostParts.length > 1 &&
20
21
  !/^([0-9]{1,3}\.){3}[0-9]{1,3}(\:[0-9]+)?$/.test(host);
21
22
  const newDomains = [];
22
23
  for (const domain of domains) {
@@ -43,7 +44,7 @@ export const getTileUrls = (req, domains, path, format, publicUrl, aliases) => {
43
44
  if (req.query.style) {
44
45
  queryParams.push(`style=${encodeURIComponent(req.query.style)}`);
45
46
  }
46
- const query = queryParams.length > 0 ? (`?${queryParams.join('&')}`) : '';
47
+ const query = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
47
48
 
48
49
  if (aliases && aliases[format]) {
49
50
  format = aliases[format];
@@ -52,7 +53,9 @@ export const getTileUrls = (req, domains, path, format, publicUrl, aliases) => {
52
53
  const uris = [];
53
54
  if (!publicUrl) {
54
55
  for (const domain of domains) {
55
- uris.push(`${req.protocol}://${domain}/${path}/{z}/{x}/{y}.${format}${query}`);
56
+ uris.push(
57
+ `${req.protocol}://${domain}/${path}/{z}/{x}/{y}.${format}${query}`,
58
+ );
56
59
  }
57
60
  } else {
58
61
  uris.push(`${publicUrl}${path}/{z}/{x}/{y}.${format}${query}`);
@@ -69,59 +72,75 @@ export const fixTileJSONCenter = (tileJSON) => {
69
72
  (tileJSON.bounds[0] + tileJSON.bounds[2]) / 2,
70
73
  (tileJSON.bounds[1] + tileJSON.bounds[3]) / 2,
71
74
  Math.round(
72
- -Math.log((tileJSON.bounds[2] - tileJSON.bounds[0]) / 360 / tiles) /
73
- Math.LN2
74
- )
75
+ -Math.log((tileJSON.bounds[2] - tileJSON.bounds[0]) / 360 / tiles) /
76
+ Math.LN2,
77
+ ),
75
78
  ];
76
79
  }
77
80
  };
78
81
 
79
- const getFontPbf = (allowedFonts, fontPath, name, range, fallbacks) => new Promise((resolve, reject) => {
80
- if (!allowedFonts || (allowedFonts[name] && fallbacks)) {
81
- const filename = path.join(fontPath, name, `${range}.pbf`);
82
- if (!fallbacks) {
83
- fallbacks = clone(allowedFonts || {});
84
- }
85
- delete fallbacks[name];
86
- fs.readFile(filename, (err, data) => {
87
- if (err) {
88
- console.error(`ERROR: Font not found: ${name}`);
89
- if (fallbacks && Object.keys(fallbacks).length) {
90
- let fallbackName;
82
+ const getFontPbf = (allowedFonts, fontPath, name, range, fallbacks) =>
83
+ new Promise((resolve, reject) => {
84
+ if (!allowedFonts || (allowedFonts[name] && fallbacks)) {
85
+ const filename = path.join(fontPath, name, `${range}.pbf`);
86
+ if (!fallbacks) {
87
+ fallbacks = clone(allowedFonts || {});
88
+ }
89
+ delete fallbacks[name];
90
+ fs.readFile(filename, (err, data) => {
91
+ if (err) {
92
+ console.error(`ERROR: Font not found: ${name}`);
93
+ if (fallbacks && Object.keys(fallbacks).length) {
94
+ let fallbackName;
91
95
 
92
- let fontStyle = name.split(' ').pop();
93
- if (['Regular', 'Bold', 'Italic'].indexOf(fontStyle) < 0) {
94
- fontStyle = 'Regular';
95
- }
96
- fallbackName = `Noto Sans ${fontStyle}`;
97
- if (!fallbacks[fallbackName]) {
98
- fallbackName = `Open Sans ${fontStyle}`;
96
+ let fontStyle = name.split(' ').pop();
97
+ if (['Regular', 'Bold', 'Italic'].indexOf(fontStyle) < 0) {
98
+ fontStyle = 'Regular';
99
+ }
100
+ fallbackName = `Noto Sans ${fontStyle}`;
99
101
  if (!fallbacks[fallbackName]) {
100
- fallbackName = Object.keys(fallbacks)[0];
102
+ fallbackName = `Open Sans ${fontStyle}`;
103
+ if (!fallbacks[fallbackName]) {
104
+ fallbackName = Object.keys(fallbacks)[0];
105
+ }
101
106
  }
102
- }
103
107
 
104
- console.error(`ERROR: Trying to use ${fallbackName} as a fallback`);
105
- delete fallbacks[fallbackName];
106
- getFontPbf(null, fontPath, fallbackName, range, fallbacks).then(resolve, reject);
108
+ console.error(`ERROR: Trying to use ${fallbackName} as a fallback`);
109
+ delete fallbacks[fallbackName];
110
+ getFontPbf(null, fontPath, fallbackName, range, fallbacks).then(
111
+ resolve,
112
+ reject,
113
+ );
114
+ } else {
115
+ reject(`Font load error: ${name}`);
116
+ }
107
117
  } else {
108
- reject(`Font load error: ${name}`);
118
+ resolve(data);
109
119
  }
110
- } else {
111
- resolve(data);
112
- }
113
- });
114
- } else {
115
- reject(`Font not allowed: ${name}`);
116
- }
117
- });
120
+ });
121
+ } else {
122
+ reject(`Font not allowed: ${name}`);
123
+ }
124
+ });
118
125
 
119
- export const getFontsPbf = (allowedFonts, fontPath, names, range, fallbacks) => {
126
+ export const getFontsPbf = (
127
+ allowedFonts,
128
+ fontPath,
129
+ names,
130
+ range,
131
+ fallbacks,
132
+ ) => {
120
133
  const fonts = names.split(',');
121
134
  const queue = [];
122
135
  for (const font of fonts) {
123
136
  queue.push(
124
- getFontPbf(allowedFonts, fontPath, font, range, clone(allowedFonts || fallbacks))
137
+ getFontPbf(
138
+ allowedFonts,
139
+ fontPath,
140
+ font,
141
+ range,
142
+ clone(allowedFonts || fallbacks),
143
+ ),
125
144
  );
126
145
  }
127
146
 
package/test/metadata.js CHANGED
@@ -1,48 +1,48 @@
1
- const testTileJSONArray = function(url) {
2
- describe(url + ' is array of TileJSONs', function() {
3
- it('is json', function(done) {
1
+ const testTileJSONArray = function (url) {
2
+ describe(url + ' is array of TileJSONs', function () {
3
+ it('is json', function (done) {
4
4
  supertest(app)
5
- .get(url)
6
- .expect(200)
7
- .expect('Content-Type', /application\/json/, done);
5
+ .get(url)
6
+ .expect(200)
7
+ .expect('Content-Type', /application\/json/, done);
8
8
  });
9
9
 
10
- it('is non-empty array', function(done) {
10
+ it('is non-empty array', function (done) {
11
11
  supertest(app)
12
- .get(url)
13
- .expect(function(res) {
14
- expect(res.body).to.be.a('array');
15
- expect(res.body.length).to.be.greaterThan(0);
16
- }).end(done);
12
+ .get(url)
13
+ .expect(function (res) {
14
+ expect(res.body).to.be.a('array');
15
+ expect(res.body.length).to.be.greaterThan(0);
16
+ })
17
+ .end(done);
17
18
  });
18
19
  });
19
20
  };
20
21
 
21
- const testTileJSON = function(url) {
22
- describe(url + ' is TileJSON', function() {
23
- it('is json', function(done) {
22
+ const testTileJSON = function (url) {
23
+ describe(url + ' is TileJSON', function () {
24
+ it('is json', function (done) {
24
25
  supertest(app)
25
- .get(url)
26
- .expect(200)
27
- .expect('Content-Type', /application\/json/, done);
26
+ .get(url)
27
+ .expect(200)
28
+ .expect('Content-Type', /application\/json/, done);
28
29
  });
29
30
 
30
- it('has valid tiles', function(done) {
31
+ it('has valid tiles', function (done) {
31
32
  supertest(app)
32
- .get(url)
33
- .expect(function(res) {
34
- expect(res.body.tiles.length).to.be.greaterThan(0);
35
- }).end(done);
33
+ .get(url)
34
+ .expect(function (res) {
35
+ expect(res.body.tiles.length).to.be.greaterThan(0);
36
+ })
37
+ .end(done);
36
38
  });
37
39
  });
38
40
  };
39
41
 
40
- describe('Metadata', function() {
41
- describe('/health', function() {
42
- it('returns 200', function(done) {
43
- supertest(app)
44
- .get('/health')
45
- .expect(200, done);
42
+ describe('Metadata', function () {
43
+ describe('/health', function () {
44
+ it('returns 200', function (done) {
45
+ supertest(app).get('/health').expect(200, done);
46
46
  });
47
47
  });
48
48
 
@@ -50,24 +50,25 @@ describe('Metadata', function() {
50
50
  testTileJSONArray('/rendered.json');
51
51
  testTileJSONArray('/data.json');
52
52
 
53
- describe('/styles.json is valid array', function() {
54
- it('is json', function(done) {
53
+ describe('/styles.json is valid array', function () {
54
+ it('is json', function (done) {
55
55
  supertest(app)
56
- .get('/styles.json')
57
- .expect(200)
58
- .expect('Content-Type', /application\/json/, done);
56
+ .get('/styles.json')
57
+ .expect(200)
58
+ .expect('Content-Type', /application\/json/, done);
59
59
  });
60
60
 
61
- it('contains valid item', function(done) {
61
+ it('contains valid item', function (done) {
62
62
  supertest(app)
63
- .get('/styles.json')
64
- .expect(function(res) {
65
- expect(res.body).to.be.a('array');
66
- expect(res.body.length).to.be.greaterThan(0);
67
- expect(res.body[0].version).to.be.equal(8);
68
- expect(res.body[0].id).to.be.a('string');
69
- expect(res.body[0].name).to.be.a('string');
70
- }).end(done);
63
+ .get('/styles.json')
64
+ .expect(function (res) {
65
+ expect(res.body).to.be.a('array');
66
+ expect(res.body.length).to.be.greaterThan(0);
67
+ expect(res.body[0].version).to.be.equal(8);
68
+ expect(res.body[0].id).to.be.a('string');
69
+ expect(res.body[0].name).to.be.a('string');
70
+ })
71
+ .end(done);
71
72
  });
72
73
  });
73
74
 
package/test/setup.js CHANGED
@@ -1,28 +1,29 @@
1
1
  process.env.NODE_ENV = 'test';
2
2
 
3
- import {expect} from 'chai';
3
+ import { expect } from 'chai';
4
4
  import supertest from 'supertest';
5
- import {server} from '../src/server.js';
5
+ import { server } from '../src/server.js';
6
6
 
7
7
  global.expect = expect;
8
8
  global.supertest = supertest;
9
9
 
10
- before(function() {
10
+ before(function () {
11
11
  console.log('global setup');
12
12
  process.chdir('test_data');
13
13
  const running = server({
14
14
  configPath: 'config.json',
15
15
  port: 8888,
16
- publicUrl: '/test/'
16
+ publicUrl: '/test/',
17
17
  });
18
18
  global.app = running.app;
19
19
  global.server = running.server;
20
20
  return running.startupPromise;
21
21
  });
22
22
 
23
- after(function() {
23
+ after(function () {
24
24
  console.log('global teardown');
25
- global.server.close(function() {
26
- console.log('Done'); process.exit();
25
+ global.server.close(function () {
26
+ console.log('Done');
27
+ process.exit();
27
28
  });
28
29
  });
package/test/static.js CHANGED
@@ -1,10 +1,10 @@
1
- const testStatic = function(prefix, q, format, status, scale, type, query) {
1
+ const testStatic = function (prefix, q, format, status, scale, type, query) {
2
2
  if (scale) q += '@' + scale + 'x';
3
3
  let path = '/styles/' + prefix + '/static/' + q + '.' + format;
4
4
  if (query) {
5
5
  path += query;
6
6
  }
7
- it(path + ' returns ' + status, function(done) {
7
+ it(path + ' returns ' + status, function (done) {
8
8
  const test = supertest(app).get(path);
9
9
  if (status) test.expect(status);
10
10
  if (type) test.expect('Content-Type', type);
@@ -14,17 +14,45 @@ const testStatic = function(prefix, q, format, status, scale, type, query) {
14
14
 
15
15
  const prefix = 'test-style';
16
16
 
17
- describe('Static endpoints', function() {
18
- describe('center-based', function() {
19
- describe('valid requests', function() {
20
- describe('various formats', function() {
21
- testStatic(prefix, '0,0,0/256x256', 'png', 200, undefined, /image\/png/);
22
- testStatic(prefix, '0,0,0/256x256', 'jpg', 200, undefined, /image\/jpeg/);
23
- testStatic(prefix, '0,0,0/256x256', 'jpeg', 200, undefined, /image\/jpeg/);
24
- testStatic(prefix, '0,0,0/256x256', 'webp', 200, undefined, /image\/webp/);
17
+ describe('Static endpoints', function () {
18
+ describe('center-based', function () {
19
+ describe('valid requests', function () {
20
+ describe('various formats', function () {
21
+ testStatic(
22
+ prefix,
23
+ '0,0,0/256x256',
24
+ 'png',
25
+ 200,
26
+ undefined,
27
+ /image\/png/,
28
+ );
29
+ testStatic(
30
+ prefix,
31
+ '0,0,0/256x256',
32
+ 'jpg',
33
+ 200,
34
+ undefined,
35
+ /image\/jpeg/,
36
+ );
37
+ testStatic(
38
+ prefix,
39
+ '0,0,0/256x256',
40
+ 'jpeg',
41
+ 200,
42
+ undefined,
43
+ /image\/jpeg/,
44
+ );
45
+ testStatic(
46
+ prefix,
47
+ '0,0,0/256x256',
48
+ 'webp',
49
+ 200,
50
+ undefined,
51
+ /image\/webp/,
52
+ );
25
53
  });
26
54
 
27
- describe('different parameters', function() {
55
+ describe('different parameters', function () {
28
56
  testStatic(prefix, '0,0,0/300x300', 'png', 200, 2);
29
57
  testStatic(prefix, '0,0,0/300x300', 'png', 200, 3);
30
58
 
@@ -42,7 +70,7 @@ describe('Static endpoints', function() {
42
70
  });
43
71
  });
44
72
 
45
- describe('invalid requests return 4xx', function() {
73
+ describe('invalid requests return 4xx', function () {
46
74
  testStatic(prefix, '190,0,0/256x256', 'png', 400);
47
75
  testStatic(prefix, '0,86,0/256x256', 'png', 400);
48
76
  testStatic(prefix, '80,40,20/0x0', 'png', 400);
@@ -57,16 +85,44 @@ describe('Static endpoints', function() {
57
85
  });
58
86
  });
59
87
 
60
- describe('area-based', function() {
61
- describe('valid requests', function() {
62
- describe('various formats', function() {
63
- testStatic(prefix, '-180,-80,180,80/10x10', 'png', 200, undefined, /image\/png/);
64
- testStatic(prefix, '-180,-80,180,80/10x10', 'jpg', 200, undefined, /image\/jpeg/);
65
- testStatic(prefix, '-180,-80,180,80/10x10', 'jpeg', 200, undefined, /image\/jpeg/);
66
- testStatic(prefix, '-180,-80,180,80/10x10', 'webp', 200, undefined, /image\/webp/);
88
+ describe('area-based', function () {
89
+ describe('valid requests', function () {
90
+ describe('various formats', function () {
91
+ testStatic(
92
+ prefix,
93
+ '-180,-80,180,80/10x10',
94
+ 'png',
95
+ 200,
96
+ undefined,
97
+ /image\/png/,
98
+ );
99
+ testStatic(
100
+ prefix,
101
+ '-180,-80,180,80/10x10',
102
+ 'jpg',
103
+ 200,
104
+ undefined,
105
+ /image\/jpeg/,
106
+ );
107
+ testStatic(
108
+ prefix,
109
+ '-180,-80,180,80/10x10',
110
+ 'jpeg',
111
+ 200,
112
+ undefined,
113
+ /image\/jpeg/,
114
+ );
115
+ testStatic(
116
+ prefix,
117
+ '-180,-80,180,80/10x10',
118
+ 'webp',
119
+ 200,
120
+ undefined,
121
+ /image\/webp/,
122
+ );
67
123
  });
68
124
 
69
- describe('different parameters', function() {
125
+ describe('different parameters', function () {
70
126
  testStatic(prefix, '-180,-90,180,90/20x20', 'png', 200, 2);
71
127
  testStatic(prefix, '0,0,1,1/200x200', 'png', 200, 3);
72
128
 
@@ -74,7 +130,7 @@ describe('Static endpoints', function() {
74
130
  });
75
131
  });
76
132
 
77
- describe('invalid requests return 4xx', function() {
133
+ describe('invalid requests return 4xx', function () {
78
134
  testStatic(prefix, '0,87,1,88/5x2', 'png', 400);
79
135
 
80
136
  testStatic(prefix, '0,0,1,1/1x1', 'gif', 400);
@@ -83,20 +139,60 @@ describe('Static endpoints', function() {
83
139
  });
84
140
  });
85
141
 
86
- describe('autofit path', function() {
87
- describe('valid requests', function() {
88
- testStatic(prefix, 'auto/256x256', 'png', 200, undefined, /image\/png/, '?path=10,10|20,20');
89
-
90
- describe('different parameters', function() {
91
- testStatic(prefix, 'auto/20x20', 'png', 200, 2, /image\/png/, '?path=10,10|20,20');
92
- testStatic(prefix, 'auto/200x200', 'png', 200, 3, /image\/png/, '?path=-10,-10|-20,-20');
142
+ describe('autofit path', function () {
143
+ describe('valid requests', function () {
144
+ testStatic(
145
+ prefix,
146
+ 'auto/256x256',
147
+ 'png',
148
+ 200,
149
+ undefined,
150
+ /image\/png/,
151
+ '?path=10,10|20,20',
152
+ );
153
+
154
+ describe('different parameters', function () {
155
+ testStatic(
156
+ prefix,
157
+ 'auto/20x20',
158
+ 'png',
159
+ 200,
160
+ 2,
161
+ /image\/png/,
162
+ '?path=10,10|20,20',
163
+ );
164
+ testStatic(
165
+ prefix,
166
+ 'auto/200x200',
167
+ 'png',
168
+ 200,
169
+ 3,
170
+ /image\/png/,
171
+ '?path=-10,-10|-20,-20',
172
+ );
93
173
  });
94
174
  });
95
175
 
96
- describe('invalid requests return 4xx', function() {
176
+ describe('invalid requests return 4xx', function () {
97
177
  testStatic(prefix, 'auto/256x256', 'png', 400);
98
- testStatic(prefix, 'auto/256x256', 'png', 400, undefined, undefined, '?path=invalid');
99
- testStatic(prefix, 'auto/2560x2560', 'png', 400, undefined, undefined, '?path=10,10|20,20');
178
+ testStatic(
179
+ prefix,
180
+ 'auto/256x256',
181
+ 'png',
182
+ 400,
183
+ undefined,
184
+ undefined,
185
+ '?path=invalid',
186
+ );
187
+ testStatic(
188
+ prefix,
189
+ 'auto/2560x2560',
190
+ 'png',
191
+ 400,
192
+ undefined,
193
+ undefined,
194
+ '?path=10,10|20,20',
195
+ );
100
196
  });
101
197
  });
102
198
  });
package/test/style.js CHANGED
@@ -1,38 +1,41 @@
1
- const testIs = function(url, type, status) {
2
- it(url + ' return ' + (status || 200) + ' and is ' + type.toString(),
3
- function(done) {
4
- supertest(app)
5
- .get(url)
6
- .expect(status || 200)
7
- .expect('Content-Type', type, done);
8
- });
1
+ const testIs = function (url, type, status) {
2
+ it(
3
+ url + ' return ' + (status || 200) + ' and is ' + type.toString(),
4
+ function (done) {
5
+ supertest(app)
6
+ .get(url)
7
+ .expect(status || 200)
8
+ .expect('Content-Type', type, done);
9
+ },
10
+ );
9
11
  };
10
12
 
11
13
  const prefix = 'test-style';
12
14
 
13
- describe('Styles', function() {
14
- describe('/styles/' + prefix + '/style.json is valid style', function() {
15
+ describe('Styles', function () {
16
+ describe('/styles/' + prefix + '/style.json is valid style', function () {
15
17
  testIs('/styles/' + prefix + '/style.json', /application\/json/);
16
18
 
17
- it('contains expected properties', function(done) {
19
+ it('contains expected properties', function (done) {
18
20
  supertest(app)
19
- .get('/styles/' + prefix + '/style.json')
20
- .expect(function(res) {
21
- expect(res.body.version).to.be.equal(8);
22
- expect(res.body.name).to.be.a('string');
23
- expect(res.body.sources).to.be.a('object');
24
- expect(res.body.glyphs).to.be.a('string');
25
- expect(res.body.sprite).to.be.a('string');
26
- expect(res.body.sprite).to.be.equal('/test/styles/test-style/sprite');
27
- expect(res.body.layers).to.be.a('array');
28
- }).end(done);
21
+ .get('/styles/' + prefix + '/style.json')
22
+ .expect(function (res) {
23
+ expect(res.body.version).to.be.equal(8);
24
+ expect(res.body.name).to.be.a('string');
25
+ expect(res.body.sources).to.be.a('object');
26
+ expect(res.body.glyphs).to.be.a('string');
27
+ expect(res.body.sprite).to.be.a('string');
28
+ expect(res.body.sprite).to.be.equal('/test/styles/test-style/sprite');
29
+ expect(res.body.layers).to.be.a('array');
30
+ })
31
+ .end(done);
29
32
  });
30
33
  });
31
- describe('/styles/streets/style.json is not served', function() {
34
+ describe('/styles/streets/style.json is not served', function () {
32
35
  testIs('/styles/streets/style.json', /./, 404);
33
36
  });
34
37
 
35
- describe('/styles/' + prefix + '/sprite[@2x].{format}', function() {
38
+ describe('/styles/' + prefix + '/sprite[@2x].{format}', function () {
36
39
  testIs('/styles/' + prefix + '/sprite.json', /application\/json/);
37
40
  testIs('/styles/' + prefix + '/sprite@2x.json', /application\/json/);
38
41
  testIs('/styles/' + prefix + '/sprite.png', /image\/png/);
@@ -40,11 +43,13 @@ describe('Styles', function() {
40
43
  });
41
44
  });
42
45
 
43
- describe('Fonts', function() {
46
+ describe('Fonts', function () {
44
47
  testIs('/fonts/Open Sans Bold/0-255.pbf', /application\/x-protobuf/);
45
48
  testIs('/fonts/Open Sans Regular/65280-65535.pbf', /application\/x-protobuf/);
46
- testIs('/fonts/Open Sans Bold,Open Sans Regular/0-255.pbf',
47
- /application\/x-protobuf/);
49
+ testIs(
50
+ '/fonts/Open Sans Bold,Open Sans Regular/0-255.pbf',
51
+ /application\/x-protobuf/,
52
+ );
48
53
  testIs('/fonts/Nonsense,Open Sans Bold/0-255.pbf', /./, 400);
49
54
 
50
55
  testIs('/fonts/Nonsense/0-255.pbf', /./, 400);
@@ -1,6 +1,6 @@
1
- const testTile = function(prefix, z, x, y, status) {
1
+ const testTile = function (prefix, z, x, y, status) {
2
2
  const path = '/data/' + prefix + '/' + z + '/' + x + '/' + y + '.pbf';
3
- it(path + ' returns ' + status, function(done) {
3
+ it(path + ' returns ' + status, function (done) {
4
4
  const test = supertest(app).get(path);
5
5
  if (status) test.expect(status);
6
6
  if (status == 200) test.expect('Content-Type', /application\/x-protobuf/);
@@ -10,13 +10,13 @@ const testTile = function(prefix, z, x, y, status) {
10
10
 
11
11
  const prefix = 'openmaptiles';
12
12
 
13
- describe('Vector tiles', function() {
14
- describe('existing tiles', function() {
13
+ describe('Vector tiles', function () {
14
+ describe('existing tiles', function () {
15
15
  testTile(prefix, 0, 0, 0, 200);
16
16
  testTile(prefix, 14, 8581, 5738, 200);
17
17
  });
18
18
 
19
- describe('non-existent requests return 4xx', function() {
19
+ describe('non-existent requests return 4xx', function () {
20
20
  testTile('non_existent', 0, 0, 0, 404);
21
21
  testTile(prefix, -1, 0, 0, 404); // err zoom
22
22
  testTile(prefix, 20, 0, 0, 404); // zoom out of bounds
@@ -1,7 +1,7 @@
1
- const testTile = function(prefix, z, x, y, format, status, scale, type) {
1
+ const testTile = function (prefix, z, x, y, format, status, scale, type) {
2
2
  if (scale) y += '@' + scale + 'x';
3
3
  const path = '/styles/' + prefix + '/' + z + '/' + x + '/' + y + '.' + format;
4
- it(path + ' returns ' + status, function(done) {
4
+ it(path + ' returns ' + status, function (done) {
5
5
  const test = supertest(app).get(path);
6
6
  test.expect(status);
7
7
  if (type) test.expect('Content-Type', type);
@@ -11,16 +11,16 @@ const testTile = function(prefix, z, x, y, format, status, scale, type) {
11
11
 
12
12
  const prefix = 'test-style';
13
13
 
14
- describe('Raster tiles', function() {
15
- describe('valid requests', function() {
16
- describe('various formats', function() {
14
+ describe('Raster tiles', function () {
15
+ describe('valid requests', function () {
16
+ describe('various formats', function () {
17
17
  testTile(prefix, 0, 0, 0, 'png', 200, undefined, /image\/png/);
18
18
  testTile(prefix, 0, 0, 0, 'jpg', 200, undefined, /image\/jpeg/);
19
19
  testTile(prefix, 0, 0, 0, 'jpeg', 200, undefined, /image\/jpeg/);
20
20
  testTile(prefix, 0, 0, 0, 'webp', 200, undefined, /image\/webp/);
21
21
  });
22
22
 
23
- describe('different coordinates and scales', function() {
23
+ describe('different coordinates and scales', function () {
24
24
  testTile(prefix, 1, 1, 1, 'png', 200);
25
25
 
26
26
  testTile(prefix, 0, 0, 0, 'png', 200, 2);
@@ -29,7 +29,7 @@ describe('Raster tiles', function() {
29
29
  });
30
30
  });
31
31
 
32
- describe('invalid requests return 4xx', function() {
32
+ describe('invalid requests return 4xx', function () {
33
33
  testTile('non_existent', 0, 0, 0, 'png', 404);
34
34
  testTile(prefix, -1, 0, 0, 'png', 404);
35
35
  testTile(prefix, 25, 0, 0, 'png', 404);