@basemaps/lambda-tiler 6.46.0 → 7.1.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/CHANGELOG.md +42 -0
- package/README.md +93 -1
- package/build/__tests__/config.data.d.ts +0 -1
- package/build/__tests__/config.data.js +2 -6
- package/build/__tests__/config.data.js.map +1 -1
- package/build/__tests__/index.test.d.ts +0 -1
- package/build/__tests__/index.test.js +28 -27
- package/build/__tests__/index.test.js.map +1 -1
- package/build/__tests__/tile.style.json.test.d.ts +0 -1
- package/build/__tests__/tile.style.json.test.js +38 -37
- package/build/__tests__/tile.style.json.test.js.map +1 -1
- package/build/__tests__/wmts.capability.test.d.ts +0 -1
- package/build/__tests__/wmts.capability.test.js +111 -122
- package/build/__tests__/wmts.capability.test.js.map +1 -1
- package/build/__tests__/xyz.util.d.ts +0 -1
- package/build/cli/render.preview.d.ts +0 -1
- package/build/cli/render.preview.js +13 -9
- package/build/cli/render.preview.js.map +1 -1
- package/build/cli/render.tile.d.ts +0 -1
- package/build/cli/render.tile.js +25 -17
- package/build/cli/render.tile.js.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.js +27 -31
- package/build/index.js.map +1 -1
- package/build/routes/__tests__/attribution.test.d.ts +0 -1
- package/build/routes/__tests__/attribution.test.js +38 -37
- package/build/routes/__tests__/attribution.test.js.map +1 -1
- package/build/routes/__tests__/fonts.test.d.ts +0 -1
- package/build/routes/__tests__/fonts.test.js +61 -63
- package/build/routes/__tests__/fonts.test.js.map +1 -1
- package/build/routes/__tests__/health.test.d.ts +0 -1
- package/build/routes/__tests__/health.test.js +16 -16
- package/build/routes/__tests__/health.test.js.map +1 -1
- package/build/routes/__tests__/imagery.test.d.ts +0 -1
- package/build/routes/__tests__/imagery.test.js +10 -9
- package/build/routes/__tests__/imagery.test.js.map +1 -1
- package/build/routes/__tests__/memory.fs.d.ts +2 -3
- package/build/routes/__tests__/preview.index.test.d.ts +0 -1
- package/build/routes/__tests__/preview.index.test.js +88 -42
- package/build/routes/__tests__/preview.index.test.js.map +1 -1
- package/build/routes/__tests__/sprites.test.d.ts +0 -1
- package/build/routes/__tests__/sprites.test.js +34 -34
- package/build/routes/__tests__/sprites.test.js.map +1 -1
- package/build/routes/__tests__/tile.json.test.d.ts +0 -1
- package/build/routes/__tests__/tile.json.test.js +45 -51
- package/build/routes/__tests__/tile.json.test.js.map +1 -1
- package/build/routes/__tests__/tile.style.json.test.d.ts +0 -1
- package/build/routes/__tests__/tile.style.json.test.js +49 -50
- package/build/routes/__tests__/tile.style.json.test.js.map +1 -1
- package/build/routes/__tests__/wmts.test.d.ts +0 -1
- package/build/routes/__tests__/wmts.test.js +27 -20
- package/build/routes/__tests__/wmts.test.js.map +1 -1
- package/build/routes/__tests__/xyz.test.d.ts +0 -1
- package/build/routes/__tests__/xyz.test.js +97 -49
- package/build/routes/__tests__/xyz.test.js.map +1 -1
- package/build/routes/attribution.d.ts +1 -1
- package/build/routes/attribution.js +4 -5
- package/build/routes/attribution.js.map +1 -1
- package/build/routes/config.d.ts +0 -1
- package/build/routes/config.js +1 -2
- package/build/routes/config.js.map +1 -1
- package/build/routes/fonts.d.ts +0 -1
- package/build/routes/fonts.js +2 -3
- package/build/routes/fonts.js.map +1 -1
- package/build/routes/health.d.ts +1 -2
- package/build/routes/health.js +5 -15
- package/build/routes/health.js.map +1 -1
- package/build/routes/imagery.d.ts +0 -1
- package/build/routes/imagery.js +1 -1
- package/build/routes/imagery.js.map +1 -1
- package/build/routes/ping.d.ts +0 -1
- package/build/routes/ping.js +1 -1
- package/build/routes/ping.js.map +1 -1
- package/build/routes/preview.d.ts +6 -5
- package/build/routes/preview.index.d.ts +0 -1
- package/build/routes/preview.index.js +6 -5
- package/build/routes/preview.index.js.map +1 -1
- package/build/routes/preview.js +35 -10
- package/build/routes/preview.js.map +1 -1
- package/build/routes/sprites.d.ts +0 -1
- package/build/routes/sprites.js +2 -4
- package/build/routes/sprites.js.map +1 -1
- package/build/routes/tile.json.d.ts +0 -1
- package/build/routes/tile.json.js +10 -5
- package/build/routes/tile.json.js.map +1 -1
- package/build/routes/tile.style.json.d.ts +1 -1
- package/build/routes/tile.style.json.js +79 -16
- package/build/routes/tile.style.json.js.map +1 -1
- package/build/routes/tile.wmts.d.ts +0 -1
- package/build/routes/tile.wmts.js +8 -9
- package/build/routes/tile.wmts.js.map +1 -1
- package/build/routes/tile.xyz.d.ts +0 -1
- package/build/routes/tile.xyz.js.map +1 -1
- package/build/routes/tile.xyz.raster.d.ts +7 -8
- package/build/routes/tile.xyz.raster.js +17 -13
- package/build/routes/tile.xyz.raster.js.map +1 -1
- package/build/routes/tile.xyz.vector.d.ts +0 -1
- package/build/routes/tile.xyz.vector.js +4 -3
- package/build/routes/tile.xyz.vector.js.map +1 -1
- package/build/routes/version.d.ts +0 -1
- package/build/routes/version.js +3 -4
- package/build/routes/version.js.map +1 -1
- package/build/util/__test__/config.loader.test.d.ts +0 -1
- package/build/util/__test__/config.loader.test.js +35 -34
- package/build/util/__test__/config.loader.test.js.map +1 -1
- package/build/util/__test__/filter.test.d.ts +0 -1
- package/build/util/__test__/filter.test.js +17 -16
- package/build/util/__test__/filter.test.js.map +1 -1
- package/build/util/__test__/validate.test.d.ts +0 -1
- package/build/util/__test__/validate.test.js +26 -43
- package/build/util/__test__/validate.test.js.map +1 -1
- package/build/util/assets.provider.d.ts +5 -5
- package/build/util/assets.provider.js +8 -8
- package/build/util/assets.provider.js.map +1 -1
- package/build/util/config.cache.d.ts +2 -2
- package/build/util/config.cache.js +14 -3
- package/build/util/config.cache.js.map +1 -1
- package/build/util/config.loader.d.ts +0 -1
- package/build/util/config.loader.js +18 -13
- package/build/util/config.loader.js.map +1 -1
- package/build/util/cotar.serve.d.ts +3 -3
- package/build/util/cotar.serve.js +2 -2
- package/build/util/cotar.serve.js.map +1 -1
- package/build/util/etag.d.ts +0 -1
- package/build/util/etag.js.map +1 -1
- package/build/util/filter.d.ts +0 -1
- package/build/util/filter.js +4 -5
- package/build/util/filter.js.map +1 -1
- package/build/util/response.d.ts +0 -1
- package/build/util/source.cache.d.ts +8 -9
- package/build/util/source.cache.js +27 -24
- package/build/util/source.cache.js.map +1 -1
- package/build/util/swapping.lru.d.ts +0 -1
- package/build/util/swapping.lru.js +48 -7
- package/build/util/swapping.lru.js.map +1 -1
- package/build/util/validate.d.ts +17 -5
- package/build/util/validate.js +51 -15
- package/build/util/validate.js.map +1 -1
- package/build/wmts.capability.d.ts +1 -2
- package/build/wmts.capability.js +81 -12
- package/build/wmts.capability.js.map +1 -1
- package/bundle.sh +2 -2
- package/package.json +16 -18
- package/scripts/create.deployment.package.mjs +4 -11
- package/src/__tests__/config.data.ts +2 -6
- package/src/__tests__/index.test.ts +29 -27
- package/src/__tests__/tile.style.json.test.ts +40 -37
- package/src/__tests__/wmts.capability.test.ts +139 -120
- package/src/cli/render.preview.ts +14 -9
- package/src/cli/render.tile.ts +27 -18
- package/src/index.ts +31 -35
- package/src/routes/__tests__/attribution.test.ts +40 -37
- package/src/routes/__tests__/fonts.test.ts +68 -64
- package/src/routes/__tests__/health.test.ts +18 -17
- package/src/routes/__tests__/imagery.test.ts +11 -9
- package/src/routes/__tests__/preview.index.test.ts +114 -40
- package/src/routes/__tests__/sprites.test.ts +39 -34
- package/src/routes/__tests__/tile.json.test.ts +41 -39
- package/src/routes/__tests__/tile.style.json.test.ts +49 -46
- package/src/routes/__tests__/wmts.test.ts +28 -20
- package/src/routes/__tests__/xyz.test.ts +134 -55
- package/src/routes/attribution.ts +2 -2
- package/src/routes/config.ts +1 -0
- package/src/routes/fonts.ts +3 -3
- package/src/routes/health.ts +7 -13
- package/src/routes/imagery.ts +2 -1
- package/src/routes/ping.ts +1 -1
- package/src/routes/preview.index.ts +9 -5
- package/src/routes/preview.ts +44 -15
- package/src/routes/sprites.ts +4 -5
- package/src/routes/tile.json.ts +9 -2
- package/src/routes/tile.style.json.ts +89 -13
- package/src/routes/tile.wmts.ts +4 -3
- package/src/routes/tile.xyz.raster.ts +26 -22
- package/src/routes/tile.xyz.ts +1 -0
- package/src/routes/tile.xyz.vector.ts +5 -3
- package/src/routes/version.ts +3 -3
- package/src/util/__test__/config.loader.test.ts +38 -34
- package/src/util/__test__/filter.test.ts +19 -16
- package/src/util/__test__/validate.test.ts +28 -43
- package/src/util/assets.provider.ts +10 -9
- package/src/util/config.cache.ts +4 -3
- package/src/util/config.loader.ts +20 -14
- package/src/util/cotar.serve.ts +3 -2
- package/src/util/source.cache.ts +15 -26
- package/src/util/validate.ts +61 -14
- package/src/wmts.capability.ts +3 -3
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/typedoc.json +4 -0
- package/build/__tests__/config.data.d.ts.map +0 -1
- package/build/__tests__/index.test.d.ts.map +0 -1
- package/build/__tests__/tile.style.json.test.d.ts.map +0 -1
- package/build/__tests__/wmts.capability.test.d.ts.map +0 -1
- package/build/__tests__/xyz.util.d.ts.map +0 -1
- package/build/arcgis/__tests__/arcgis.style.json.test.d.ts +0 -2
- package/build/arcgis/__tests__/arcgis.style.json.test.d.ts.map +0 -1
- package/build/arcgis/__tests__/arcgis.style.json.test.js +0 -131
- package/build/arcgis/__tests__/arcgis.style.json.test.js.map +0 -1
- package/build/arcgis/__tests__/vector.tiler.server.test.d.ts +0 -2
- package/build/arcgis/__tests__/vector.tiler.server.test.d.ts.map +0 -1
- package/build/arcgis/__tests__/vector.tiler.server.test.js +0 -54
- package/build/arcgis/__tests__/vector.tiler.server.test.js.map +0 -1
- package/build/arcgis/arcgis.info.d.ts +0 -3
- package/build/arcgis/arcgis.info.d.ts.map +0 -1
- package/build/arcgis/arcgis.info.js +0 -25
- package/build/arcgis/arcgis.info.js.map +0 -1
- package/build/arcgis/arcgis.style.json.d.ts +0 -9
- package/build/arcgis/arcgis.style.json.d.ts.map +0 -1
- package/build/arcgis/arcgis.style.json.js +0 -75
- package/build/arcgis/arcgis.style.json.js.map +0 -1
- package/build/arcgis/vector.tile.server.d.ts +0 -8
- package/build/arcgis/vector.tile.server.d.ts.map +0 -1
- package/build/arcgis/vector.tile.server.js +0 -73
- package/build/arcgis/vector.tile.server.js.map +0 -1
- package/build/cli/render.preview.d.ts.map +0 -1
- package/build/cli/render.tile.d.ts.map +0 -1
- package/build/index.d.ts.map +0 -1
- package/build/routes/__tests__/attribution.test.d.ts.map +0 -1
- package/build/routes/__tests__/fonts.test.d.ts.map +0 -1
- package/build/routes/__tests__/health.test.d.ts.map +0 -1
- package/build/routes/__tests__/imagery.test.d.ts.map +0 -1
- package/build/routes/__tests__/memory.fs.d.ts.map +0 -1
- package/build/routes/__tests__/preview.index.test.d.ts.map +0 -1
- package/build/routes/__tests__/sprites.test.d.ts.map +0 -1
- package/build/routes/__tests__/tile.json.test.d.ts.map +0 -1
- package/build/routes/__tests__/tile.style.json.test.d.ts.map +0 -1
- package/build/routes/__tests__/wmts.test.d.ts.map +0 -1
- package/build/routes/__tests__/xyz.test.d.ts.map +0 -1
- package/build/routes/attribution.d.ts.map +0 -1
- package/build/routes/config.d.ts.map +0 -1
- package/build/routes/fonts.d.ts.map +0 -1
- package/build/routes/health.d.ts.map +0 -1
- package/build/routes/imagery.d.ts.map +0 -1
- package/build/routes/ping.d.ts.map +0 -1
- package/build/routes/preview.d.ts.map +0 -1
- package/build/routes/preview.index.d.ts.map +0 -1
- package/build/routes/sprites.d.ts.map +0 -1
- package/build/routes/tile.json.d.ts.map +0 -1
- package/build/routes/tile.style.json.d.ts.map +0 -1
- package/build/routes/tile.wmts.d.ts.map +0 -1
- package/build/routes/tile.xyz.d.ts.map +0 -1
- package/build/routes/tile.xyz.raster.d.ts.map +0 -1
- package/build/routes/tile.xyz.vector.d.ts.map +0 -1
- package/build/routes/version.d.ts.map +0 -1
- package/build/util/__test__/config.loader.test.d.ts.map +0 -1
- package/build/util/__test__/filter.test.d.ts.map +0 -1
- package/build/util/__test__/validate.test.d.ts.map +0 -1
- package/build/util/assets.provider.d.ts.map +0 -1
- package/build/util/config.cache.d.ts.map +0 -1
- package/build/util/config.loader.d.ts.map +0 -1
- package/build/util/cotar.serve.d.ts.map +0 -1
- package/build/util/etag.d.ts.map +0 -1
- package/build/util/filter.d.ts.map +0 -1
- package/build/util/response.d.ts.map +0 -1
- package/build/util/source.cache.d.ts.map +0 -1
- package/build/util/source.tracer.d.ts +0 -18
- package/build/util/source.tracer.d.ts.map +0 -1
- package/build/util/source.tracer.js +0 -26
- package/build/util/source.tracer.js.map +0 -1
- package/build/util/swapping.lru.d.ts.map +0 -1
- package/build/util/validate.d.ts.map +0 -1
- package/build/wmts.capability.d.ts.map +0 -1
- package/src/arcgis/__tests__/arcgis.style.json.test.ts +0 -157
- package/src/arcgis/__tests__/vector.tiler.server.test.ts +0 -70
- package/src/arcgis/arcgis.info.ts +0 -26
- package/src/arcgis/arcgis.style.json.ts +0 -83
- package/src/arcgis/vector.tile.server.ts +0 -81
- package/src/util/source.tracer.ts +0 -38
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
|
|
2
4
|
import { isAllowedFile } from '../imagery.js';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
describe('ImageryRoute', () => {
|
|
7
|
+
it('should allow geojson and json files only', () => {
|
|
8
|
+
assert.equal(isAllowedFile('foo.geojson'), true);
|
|
9
|
+
assert.equal(isAllowedFile('foo.json'), true);
|
|
10
|
+
assert.equal(isAllowedFile('foo.tiff'), false);
|
|
11
|
+
assert.equal(isAllowedFile('foo'), false);
|
|
12
|
+
assert.equal(isAllowedFile(''), false);
|
|
13
|
+
assert.equal(isAllowedFile(null as any), false);
|
|
12
14
|
});
|
|
13
15
|
});
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { afterEach, beforeEach, describe, it } from 'node:test';
|
|
3
|
+
|
|
4
|
+
import { ConfigProviderMemory, DefaultColorRampOutput, DefaultTerrainRgbOutput } from '@basemaps/config';
|
|
5
|
+
import { LocationUrl } from '@basemaps/geo';
|
|
6
|
+
import { Env, fsa, FsMemory, LogConfig, V } from '@basemaps/shared';
|
|
2
7
|
import { LambdaAlbRequest, LambdaHttpRequest, LambdaHttpResponse } from '@linzjs/lambda';
|
|
3
8
|
import { ALBEvent, Context } from 'aws-lambda';
|
|
4
|
-
import o from 'ospec';
|
|
5
9
|
|
|
6
|
-
import { PreviewIndexGet, loadAndServeIndexHtml, previewIndexGet } from '../preview.index.js';
|
|
7
|
-
import { LocationUrl } from '@basemaps/geo';
|
|
8
|
-
import { FsMemory } from '@chunkd/source-memory';
|
|
9
|
-
import { ConfigProviderMemory } from '@basemaps/config';
|
|
10
10
|
import { FakeData } from '../../__tests__/config.data.js';
|
|
11
|
+
import { CachedConfig } from '../../util/config.cache.js';
|
|
12
|
+
import { loadAndServeIndexHtml, PreviewIndexGet, previewIndexGet } from '../preview.index.js';
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
o.specTimeout(1000);
|
|
14
|
+
describe('/@*', async () => {
|
|
15
|
+
// o.specTimeout(1000);
|
|
14
16
|
const baseRequest: ALBEvent = {
|
|
15
17
|
requestContext: null as any,
|
|
16
18
|
httpMethod: 'get',
|
|
@@ -21,51 +23,63 @@ o.spec('/@*', async () => {
|
|
|
21
23
|
|
|
22
24
|
const fsMem = new FsMemory();
|
|
23
25
|
let lastLocation: string | undefined;
|
|
24
|
-
|
|
26
|
+
beforeEach(async () => {
|
|
27
|
+
CachedConfig.cache.clear();
|
|
28
|
+
|
|
25
29
|
fsa.register('memory://', fsMem);
|
|
30
|
+
|
|
31
|
+
const indexHtml = V('html', [
|
|
32
|
+
V('head', [
|
|
33
|
+
V('meta', { property: 'og:title', content: 'LINZ Basemaps' }),
|
|
34
|
+
V('meta', { property: 'og:image', content: '/basemaps-card.jpeg' }),
|
|
35
|
+
V('meta', { name: 'viewport' }),
|
|
36
|
+
]),
|
|
37
|
+
]).toString();
|
|
38
|
+
await fsa.write(new URL('memory://assets/index.html'), indexHtml);
|
|
39
|
+
|
|
26
40
|
lastLocation = process.env[Env.StaticAssetLocation];
|
|
27
41
|
});
|
|
28
|
-
|
|
42
|
+
afterEach(() => {
|
|
29
43
|
if (lastLocation == null) delete process.env[Env.StaticAssetLocation];
|
|
30
44
|
else process.env[Env.StaticAssetLocation] = lastLocation;
|
|
31
45
|
});
|
|
32
46
|
|
|
33
|
-
|
|
47
|
+
it('Should redirect on failure to load', async () => {
|
|
34
48
|
const ctx: LambdaHttpRequest = new LambdaAlbRequest(baseRequest, {} as Context, LogConfig.get());
|
|
35
49
|
|
|
36
50
|
const res = await loadAndServeIndexHtml(ctx);
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
assert.equal(res.status, 302);
|
|
52
|
+
assert.equal(res.header('location'), '/?');
|
|
39
53
|
});
|
|
40
54
|
|
|
41
|
-
|
|
55
|
+
it('Should redirect with querystring on failure to load', async () => {
|
|
42
56
|
const evt: ALBEvent = { ...baseRequest, queryStringParameters: { config: 'config-latest.json' } };
|
|
43
57
|
const ctx: LambdaHttpRequest = new LambdaAlbRequest(evt, {} as Context, LogConfig.get());
|
|
44
58
|
|
|
45
59
|
const res = await loadAndServeIndexHtml(ctx);
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
assert.equal(res.status, 302);
|
|
61
|
+
assert.equal(res.header('location'), '/?config=config-latest.json');
|
|
48
62
|
});
|
|
49
63
|
|
|
50
|
-
|
|
64
|
+
it('Should redirect with querystring and location on failure to load', async () => {
|
|
51
65
|
const evt: ALBEvent = { ...baseRequest, queryStringParameters: { config: 'config-latest.json' } };
|
|
52
66
|
const loc = LocationUrl.fromSlug(evt.path);
|
|
53
67
|
const ctx: LambdaHttpRequest = new LambdaAlbRequest(evt, {} as Context, LogConfig.get());
|
|
54
68
|
|
|
55
69
|
const res = await loadAndServeIndexHtml(ctx, loc);
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
assert.equal(res.status, 302);
|
|
71
|
+
assert.equal(res.header('location'), '/?config=config-latest.json#@-41.8900012,174.0492432,z5');
|
|
58
72
|
});
|
|
59
73
|
|
|
60
|
-
|
|
74
|
+
it('should redirect on failure to load index.html', async () => {
|
|
61
75
|
const ctx: LambdaHttpRequest = new LambdaAlbRequest(baseRequest, {} as Context, LogConfig.get());
|
|
62
|
-
process.env[Env.StaticAssetLocation] = 'memory://assets/';
|
|
76
|
+
process.env[Env.StaticAssetLocation] = 'memory://assets-missing/';
|
|
63
77
|
|
|
64
78
|
const res = await loadAndServeIndexHtml(ctx);
|
|
65
|
-
|
|
79
|
+
assert.equal(res.status, 302);
|
|
66
80
|
});
|
|
67
81
|
|
|
68
|
-
|
|
82
|
+
it('should redirect with new tags!', async () => {
|
|
69
83
|
const ctx = new LambdaAlbRequest(baseRequest, {} as Context, LogConfig.get());
|
|
70
84
|
process.env[Env.StaticAssetLocation] = 'memory://assets/';
|
|
71
85
|
|
|
@@ -77,18 +91,20 @@ o.spec('/@*', async () => {
|
|
|
77
91
|
]),
|
|
78
92
|
]).toString();
|
|
79
93
|
|
|
80
|
-
await fsa.write('memory://assets/index.html', indexHtml);
|
|
94
|
+
await fsa.write(new URL('memory://assets/index.html'), indexHtml);
|
|
81
95
|
|
|
82
96
|
// Pass back the body un altered
|
|
83
97
|
const res = await loadAndServeIndexHtml(ctx);
|
|
84
|
-
|
|
98
|
+
assert.equal(getBody(res)?.toString(), indexHtml);
|
|
85
99
|
|
|
86
100
|
// Replace og:title with a <fake tag />
|
|
87
101
|
const resB = await loadAndServeIndexHtml(ctx, null, new Map([['og:title', '<fake tag />']]));
|
|
88
|
-
|
|
102
|
+
assert.equal(getBody(resB)?.toString().includes('<fake tag />'), true);
|
|
89
103
|
});
|
|
90
104
|
|
|
91
|
-
|
|
105
|
+
it('should include config url', async () => {
|
|
106
|
+
process.env[Env.StaticAssetLocation] = 'memory://assets/';
|
|
107
|
+
|
|
92
108
|
const ctx = new LambdaAlbRequest(
|
|
93
109
|
{
|
|
94
110
|
...baseRequest,
|
|
@@ -99,32 +115,90 @@ o.spec('/@*', async () => {
|
|
|
99
115
|
) as unknown as LambdaHttpRequest<PreviewIndexGet>;
|
|
100
116
|
ctx.params = { location: '@-41.8900012,174.0492432,z5' };
|
|
101
117
|
|
|
102
|
-
// Create a fake config to use
|
|
103
118
|
const expectedConfig = new ConfigProviderMemory();
|
|
104
119
|
expectedConfig.put(FakeData.tileSetRaster('imagery-name'));
|
|
105
|
-
await fsa.write('memory://linz-basemaps/config-latest.json', JSON.stringify(expectedConfig.toJson()));
|
|
120
|
+
await fsa.write(new URL('memory://linz-basemaps/config-latest.json'), JSON.stringify(expectedConfig.toJson()));
|
|
121
|
+
|
|
122
|
+
const res = await previewIndexGet(ctx);
|
|
123
|
+
assert.equal(res.status, 200);
|
|
106
124
|
|
|
125
|
+
const ogImage = getBody(res)
|
|
126
|
+
?.toString()
|
|
127
|
+
.split('\n')
|
|
128
|
+
.find((f) => f.includes('og:image'));
|
|
129
|
+
assert.equal(
|
|
130
|
+
ogImage,
|
|
131
|
+
'<meta name="twitter:image" property="og:image" content="/v1/preview/imagery-name/WebMercatorQuad/5/174.0492432/-41.8900012?config=QzX7ZsK6qG6p42wHZaF9dhihsgprX942gAuKwfryknM429iqxdDiRSGu" />',
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('should include default pipeline', { only: true }, async () => {
|
|
107
136
|
process.env[Env.StaticAssetLocation] = 'memory://assets/';
|
|
108
137
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
138
|
+
const ctx = new LambdaAlbRequest(
|
|
139
|
+
{
|
|
140
|
+
...baseRequest,
|
|
141
|
+
queryStringParameters: { config: 'memory://linz-basemaps/config-latest.json', i: 'imagery-name' },
|
|
142
|
+
},
|
|
143
|
+
{} as Context,
|
|
144
|
+
LogConfig.get(),
|
|
145
|
+
) as unknown as LambdaHttpRequest<PreviewIndexGet>;
|
|
146
|
+
ctx.params = { location: '@-41.8900012,174.0492432,z5' };
|
|
116
147
|
|
|
117
|
-
|
|
148
|
+
const expectedConfig = new ConfigProviderMemory();
|
|
149
|
+
const ts = FakeData.tileSetRaster('imagery-name');
|
|
150
|
+
ts.outputs = [DefaultTerrainRgbOutput, DefaultColorRampOutput];
|
|
151
|
+
expectedConfig.put(ts);
|
|
152
|
+
await fsa.write(new URL('memory://linz-basemaps/config-latest.json'), JSON.stringify(expectedConfig.toJson()));
|
|
118
153
|
|
|
119
154
|
const res = await previewIndexGet(ctx);
|
|
120
|
-
|
|
155
|
+
assert.equal(res.status, 200, res.statusDescription);
|
|
121
156
|
|
|
122
157
|
const ogImage = getBody(res)
|
|
123
158
|
?.toString()
|
|
124
159
|
.split('\n')
|
|
125
160
|
.find((f) => f.includes('og:image'));
|
|
126
|
-
|
|
127
|
-
|
|
161
|
+
|
|
162
|
+
assert.equal(
|
|
163
|
+
ogImage,
|
|
164
|
+
'<meta name="twitter:image" property="og:image" content="/v1/preview/imagery-name/WebMercatorQuad/5/174.0492432/-41.8900012?config=QzX7ZsK6qG6p42wHZaF9dhihsgprX942gAuKwfryknM429iqxdDiRSGu&pipeline=terrain-rgb" />',
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should include pipelines', async () => {
|
|
169
|
+
process.env[Env.StaticAssetLocation] = 'memory://assets/';
|
|
170
|
+
|
|
171
|
+
const ctx = new LambdaAlbRequest(
|
|
172
|
+
{
|
|
173
|
+
...baseRequest,
|
|
174
|
+
queryStringParameters: {
|
|
175
|
+
config: 'memory://linz-basemaps/config-latest.json',
|
|
176
|
+
i: 'imagery-name',
|
|
177
|
+
pipeline: 'color-ramp',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{} as Context,
|
|
181
|
+
LogConfig.get(),
|
|
182
|
+
) as unknown as LambdaHttpRequest<PreviewIndexGet>;
|
|
183
|
+
ctx.params = { location: '@-41.8900012,174.0492432,z5' };
|
|
184
|
+
|
|
185
|
+
const expectedConfig = new ConfigProviderMemory();
|
|
186
|
+
const ts = FakeData.tileSetRaster('imagery-name');
|
|
187
|
+
ts.outputs = [DefaultTerrainRgbOutput, DefaultColorRampOutput];
|
|
188
|
+
expectedConfig.put(ts);
|
|
189
|
+
await fsa.write(new URL('memory://linz-basemaps/config-latest.json'), JSON.stringify(expectedConfig.toJson()));
|
|
190
|
+
|
|
191
|
+
const res = await previewIndexGet(ctx);
|
|
192
|
+
assert.equal(res.status, 200, res.statusDescription);
|
|
193
|
+
|
|
194
|
+
const ogImage = getBody(res)
|
|
195
|
+
?.toString()
|
|
196
|
+
.split('\n')
|
|
197
|
+
.find((f) => f.includes('og:image'));
|
|
198
|
+
|
|
199
|
+
assert.equal(
|
|
200
|
+
ogImage,
|
|
201
|
+
'<meta name="twitter:image" property="og:image" content="/v1/preview/imagery-name/WebMercatorQuad/5/174.0492432/-41.8900012?config=QzX7ZsK6qG6p42wHZaF9dhihsgprX942gAuKwfryknM429iqxdDiRSGu&pipeline=color-ramp" />',
|
|
128
202
|
);
|
|
129
203
|
});
|
|
130
204
|
});
|
|
@@ -1,69 +1,74 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { afterEach, before, beforeEach, describe, it } from 'node:test';
|
|
3
|
+
|
|
1
4
|
import { ConfigProviderMemory } from '@basemaps/config';
|
|
2
|
-
import { fsa } from '@chunkd/fs';
|
|
3
|
-
import o from 'ospec';
|
|
5
|
+
import { fsa, FsMemory } from '@chunkd/fs';
|
|
4
6
|
import { createSandbox } from 'sinon';
|
|
5
7
|
import { gunzipSync, gzipSync } from 'zlib';
|
|
8
|
+
|
|
9
|
+
import { mockRequest } from '../../__tests__/xyz.util.js';
|
|
6
10
|
import { handler } from '../../index.js';
|
|
7
11
|
import { ConfigLoader } from '../../util/config.loader.js';
|
|
8
|
-
import { mockRequest } from '../../__tests__/xyz.util.js';
|
|
9
|
-
import { FsMemory } from '@chunkd/source-memory';
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
describe('/v1/sprites', () => {
|
|
12
14
|
const memory = new FsMemory();
|
|
13
15
|
const sandbox = createSandbox();
|
|
14
16
|
const config = new ConfigProviderMemory();
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
fsa.register('
|
|
18
|
+
before(() => {
|
|
19
|
+
fsa.register('fake-s3://assets/', memory);
|
|
18
20
|
});
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
config.assets = '
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
config.assets = 'fake-s3://assets/';
|
|
22
24
|
sandbox.stub(ConfigLoader, 'getDefaultConfig').resolves(config);
|
|
23
25
|
});
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
afterEach(() => {
|
|
26
28
|
memory.files.clear();
|
|
27
29
|
sandbox.restore();
|
|
28
30
|
});
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
it('should fetch a json document', async () => {
|
|
31
33
|
await Promise.all([
|
|
32
|
-
fsa.write('
|
|
33
|
-
fsa.write('
|
|
34
|
+
fsa.write(new URL('fake-s3://assets/sprites/topographic.json'), Buffer.from(JSON.stringify({ test: true }))),
|
|
35
|
+
fsa.write(new URL('fake-s3://assets/sprites/topographic.png'), Buffer.from('')),
|
|
34
36
|
]);
|
|
35
37
|
const res = await handler.router.handle(mockRequest('/v1/sprites/topographic.json'));
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
assert.equal(res.status, 200);
|
|
39
|
+
assert.equal(res.header('content-type'), 'application/json');
|
|
40
|
+
assert.equal(res.header('content-encoding'), undefined);
|
|
41
|
+
assert.notEqual(res.header('etag'), undefined);
|
|
42
|
+
assert.equal(res.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
assert.deepEqual(JSON.parse(Buffer.from(res.body, 'base64').toString()), { test: true });
|
|
43
45
|
});
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
it('should fetch a png', async () => {
|
|
46
48
|
await Promise.all([
|
|
47
|
-
fsa.write('
|
|
48
|
-
fsa.write('
|
|
49
|
+
fsa.write(new URL('fake-s3://assets/sprites/topographic.json'), Buffer.from(JSON.stringify({ test: true }))),
|
|
50
|
+
fsa.write(new URL('fake-s3://assets/sprites/topographic@2x.png'), Buffer.from('')),
|
|
49
51
|
]);
|
|
50
52
|
const res = await handler.router.handle(mockRequest('/v1/sprites/topographic@2x.png'));
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
assert.equal(res.status, 200);
|
|
54
|
+
assert.equal(res.header('content-type'), 'image/png');
|
|
55
|
+
assert.notEqual(res.header('etag'), undefined);
|
|
56
|
+
assert.equal(res.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
|
|
55
57
|
});
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
it('should detect gziped files and set content-encoding', async () => {
|
|
58
60
|
await Promise.all([
|
|
59
|
-
fsa.write(
|
|
61
|
+
fsa.write(
|
|
62
|
+
new URL('fake-s3://assets/sprites/topographic.json'),
|
|
63
|
+
gzipSync(Buffer.from(JSON.stringify({ test: true }))),
|
|
64
|
+
),
|
|
60
65
|
]);
|
|
61
66
|
const res = await handler.router.handle(mockRequest('/v1/sprites/topographic.json'));
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
assert.equal(res.status, 200);
|
|
68
|
+
assert.equal(res.header('content-type'), 'application/json');
|
|
69
|
+
assert.equal(res.header('content-encoding'), 'gzip');
|
|
70
|
+
assert.notEqual(res.header('etag'), undefined);
|
|
71
|
+
assert.equal(res.header('cache-control'), 'public, max-age=604800, stale-while-revalidate=86400');
|
|
72
|
+
assert.deepEqual(JSON.parse(gunzipSync(Buffer.from(res.body, 'base64')).toString()), { test: true });
|
|
68
73
|
});
|
|
69
74
|
});
|
|
@@ -1,68 +1,70 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { afterEach, before, beforeEach, describe, it } from 'node:test';
|
|
3
|
+
|
|
1
4
|
import { base58, ConfigProviderMemory } from '@basemaps/config';
|
|
2
5
|
import { Env } from '@basemaps/shared';
|
|
3
|
-
import { fsa } from '@chunkd/fs';
|
|
4
|
-
import o from 'ospec';
|
|
6
|
+
import { fsa, FsMemory } from '@chunkd/fs';
|
|
5
7
|
import sinon from 'sinon';
|
|
8
|
+
|
|
9
|
+
import { FakeData } from '../../__tests__/config.data.js';
|
|
10
|
+
import { Api, mockRequest, mockUrlRequest } from '../../__tests__/xyz.util.js';
|
|
6
11
|
import { handler } from '../../index.js';
|
|
7
12
|
import { ConfigLoader } from '../../util/config.loader.js';
|
|
8
13
|
import { CoSources } from '../../util/source.cache.js';
|
|
9
|
-
import { FakeData } from '../../__tests__/config.data.js';
|
|
10
|
-
import { Api, mockRequest, mockUrlRequest } from '../../__tests__/xyz.util.js';
|
|
11
|
-
import { FsMemory } from '@chunkd/source-memory';
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
describe('/v1/tiles/:tileSet/:tileMatrix/tile.json', () => {
|
|
14
16
|
const config = new ConfigProviderMemory();
|
|
15
17
|
const sandbox = sinon.createSandbox();
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
before(() => {
|
|
18
20
|
process.env[Env.PublicUrlBase] = 'https://tiles.test';
|
|
19
21
|
});
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
beforeEach(() => {
|
|
22
24
|
sandbox.stub(ConfigLoader, 'getDefaultConfig').resolves(config);
|
|
23
25
|
config.objects.clear();
|
|
24
26
|
CoSources.cache.clear();
|
|
25
27
|
});
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
afterEach(() => {
|
|
28
30
|
sandbox.restore();
|
|
29
31
|
});
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
it('should 404 if invalid url is given', async () => {
|
|
32
34
|
const request = mockRequest('/v1/tiles/tile.json', 'get', Api.header);
|
|
33
35
|
|
|
34
36
|
const res = await handler.router.handle(request);
|
|
35
|
-
|
|
37
|
+
assert.equal(res.status, 404);
|
|
36
38
|
});
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
it('should support utf8 tilesets', async () => {
|
|
39
41
|
const request = mockUrlRequest('/v1/tiles/🦄 🌈/NZTM2000Quad/tile.json', `api=${Api.key}`);
|
|
40
|
-
|
|
42
|
+
assert.equal(request.path, '/v1/tiles/%F0%9F%A6%84%20%F0%9F%8C%88/NZTM2000Quad/tile.json');
|
|
41
43
|
|
|
42
44
|
const fakeTileSet = FakeData.tileSetRaster('🦄 🌈');
|
|
43
45
|
config.put(fakeTileSet);
|
|
44
46
|
|
|
45
47
|
const res = await handler.router.handle(request);
|
|
46
|
-
|
|
48
|
+
assert.equal(res.status, 200);
|
|
47
49
|
});
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
it('should serve tile json for tile_set', async () => {
|
|
50
52
|
const request = mockRequest('/v1/tiles/aerial/NZTM2000Quad/tile.json', 'get', Api.header);
|
|
51
53
|
const fakeTileSet = FakeData.tileSetRaster('aerial');
|
|
52
54
|
config.put(fakeTileSet);
|
|
53
55
|
|
|
54
56
|
const res = await handler.router.handle(request);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
assert.equal(res.status, 200);
|
|
58
|
+
assert.equal(res.header('cache-control'), 'no-store');
|
|
57
59
|
|
|
58
60
|
const body = Buffer.from(res.body ?? '', 'base64').toString();
|
|
59
|
-
|
|
61
|
+
assert.deepEqual(JSON.parse(body), {
|
|
60
62
|
tiles: [`https://tiles.test/v1/tiles/aerial/NZTM2000Quad/{z}/{x}/{y}.webp?api=${Api.key}`],
|
|
61
63
|
tilejson: '3.0.0',
|
|
62
64
|
});
|
|
63
65
|
});
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
it('should use the correct format', async () => {
|
|
66
68
|
const request = mockRequest('/v1/tiles/aerial/NZTM2000Quad/tile.json', 'get', Api.header);
|
|
67
69
|
request.query.set('format', 'jpeg');
|
|
68
70
|
|
|
@@ -70,17 +72,17 @@ o.spec('/v1/tiles/:tileSet/:tileMatrix/tile.json', () => {
|
|
|
70
72
|
config.put(fakeTileSet);
|
|
71
73
|
|
|
72
74
|
const res = await handler.router.handle(request);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
assert.equal(res.status, 200);
|
|
76
|
+
assert.equal(res.header('cache-control'), 'no-store');
|
|
75
77
|
|
|
76
78
|
const body = Buffer.from(res.body ?? '', 'base64').toString();
|
|
77
|
-
|
|
79
|
+
assert.deepEqual(JSON.parse(body), {
|
|
78
80
|
tiles: [`https://tiles.test/v1/tiles/aerial/NZTM2000Quad/{z}/{x}/{y}.jpeg?api=${Api.key}`],
|
|
79
81
|
tilejson: '3.0.0',
|
|
80
82
|
});
|
|
81
83
|
});
|
|
82
84
|
|
|
83
|
-
|
|
85
|
+
it('should use the correct format when multiple set', async () => {
|
|
84
86
|
const request = mockRequest('/v1/tiles/aerial/NZTM2000Quad/tile.json', 'get', Api.header);
|
|
85
87
|
request.query.append('format', 'png');
|
|
86
88
|
request.query.append('format', 'jpeg');
|
|
@@ -89,32 +91,32 @@ o.spec('/v1/tiles/:tileSet/:tileMatrix/tile.json', () => {
|
|
|
89
91
|
config.put(fakeTileSet);
|
|
90
92
|
|
|
91
93
|
const res = await handler.router.handle(request);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
assert.equal(res.status, 200);
|
|
95
|
+
assert.equal(res.header('cache-control'), 'no-store');
|
|
94
96
|
|
|
95
97
|
const body = Buffer.from(res.body ?? '', 'base64').toString();
|
|
96
|
-
|
|
98
|
+
assert.deepEqual(JSON.parse(body), {
|
|
97
99
|
tiles: [`https://tiles.test/v1/tiles/aerial/NZTM2000Quad/{z}/{x}/{y}.png?api=${Api.key}`],
|
|
98
100
|
tilejson: '3.0.0',
|
|
99
101
|
});
|
|
100
102
|
});
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
it('should serve vector tiles', async () => {
|
|
103
105
|
const request = mockRequest('/v1/tiles/topographic/EPSG:3857/tile.json', 'get', Api.header);
|
|
104
106
|
const fakeTileSet = FakeData.tileSetVector('topographic');
|
|
105
107
|
config.put(fakeTileSet);
|
|
106
108
|
|
|
107
109
|
const res = await handler.router.handle(request);
|
|
108
|
-
|
|
110
|
+
assert.equal(res.status, 200);
|
|
109
111
|
|
|
110
112
|
const body = Buffer.from(res.body ?? '', 'base64').toString();
|
|
111
|
-
|
|
113
|
+
assert.deepEqual(JSON.parse(body), {
|
|
112
114
|
tiles: [`https://tiles.test/v1/tiles/topographic/WebMercatorQuad/{z}/{x}/{y}.pbf?api=${Api.key}`],
|
|
113
115
|
tilejson: '3.0.0',
|
|
114
116
|
});
|
|
115
117
|
});
|
|
116
118
|
|
|
117
|
-
|
|
119
|
+
it('should serve vector tiles with min/max zoom', async () => {
|
|
118
120
|
const fakeTileSet = FakeData.tileSetVector('fake-vector');
|
|
119
121
|
fakeTileSet.maxZoom = 15;
|
|
120
122
|
fakeTileSet.minZoom = 3;
|
|
@@ -122,10 +124,10 @@ o.spec('/v1/tiles/:tileSet/:tileMatrix/tile.json', () => {
|
|
|
122
124
|
const request = mockRequest('/v1/tiles/fake-vector/WebMercatorQuad/tile.json', 'get', Api.header);
|
|
123
125
|
|
|
124
126
|
const res = await handler.router.handle(request);
|
|
125
|
-
|
|
127
|
+
assert.equal(res.status, 200);
|
|
126
128
|
|
|
127
129
|
const body = Buffer.from(res.body ?? '', 'base64').toString();
|
|
128
|
-
|
|
130
|
+
assert.deepEqual(JSON.parse(body), {
|
|
129
131
|
tiles: [`https://tiles.test/v1/tiles/fake-vector/WebMercatorQuad/{z}/{x}/{y}.pbf?api=${Api.key}`],
|
|
130
132
|
maxzoom: 15,
|
|
131
133
|
minzoom: 3,
|
|
@@ -133,25 +135,25 @@ o.spec('/v1/tiles/:tileSet/:tileMatrix/tile.json', () => {
|
|
|
133
135
|
});
|
|
134
136
|
});
|
|
135
137
|
|
|
136
|
-
|
|
138
|
+
it('should load from config bundle', async () => {
|
|
137
139
|
const memoryFs = new FsMemory();
|
|
138
140
|
fsa.register('memory://', memoryFs);
|
|
139
141
|
const fakeTileSet = FakeData.tileSetRaster('🦄 🌈');
|
|
140
142
|
|
|
141
143
|
const cfgBundle = new ConfigProviderMemory();
|
|
142
144
|
cfgBundle.put(fakeTileSet);
|
|
143
|
-
memoryFs.write('memory://linz-basemaps/bar.json', JSON.stringify(cfgBundle.toJson()));
|
|
145
|
+
memoryFs.write(new URL('memory://linz-basemaps/bar.json'), JSON.stringify(cfgBundle.toJson()));
|
|
144
146
|
|
|
145
147
|
const configLocation = base58.encode(Buffer.from('memory://linz-basemaps/bar.json'));
|
|
146
148
|
const request = mockUrlRequest('/v1/tiles/🦄 🌈/NZTM2000Quad/tile.json', `?config=${configLocation}`, Api.header);
|
|
147
149
|
const res = await handler.router.handle(request);
|
|
148
|
-
|
|
150
|
+
assert.equal(res.status, 200);
|
|
149
151
|
|
|
150
152
|
const body = JSON.parse(Buffer.from(res.body, 'base64').toString());
|
|
151
|
-
|
|
153
|
+
assert.equal(body.tiles[0].includes(`config=${configLocation}`), true);
|
|
152
154
|
});
|
|
153
155
|
|
|
154
|
-
|
|
156
|
+
it('should serve convert zoom to tile matrix', async () => {
|
|
155
157
|
const fakeTileSet = FakeData.tileSetVector('fake-vector');
|
|
156
158
|
fakeTileSet.maxZoom = 15;
|
|
157
159
|
fakeTileSet.minZoom = 1;
|
|
@@ -160,10 +162,10 @@ o.spec('/v1/tiles/:tileSet/:tileMatrix/tile.json', () => {
|
|
|
160
162
|
const request = mockRequest('/v1/tiles/fake-vector/NZTM2000Quad/tile.json', 'get', Api.header);
|
|
161
163
|
|
|
162
164
|
const res = await handler.router.handle(request);
|
|
163
|
-
|
|
165
|
+
assert.equal(res.status, 200);
|
|
164
166
|
|
|
165
167
|
const body = Buffer.from(res.body ?? '', 'base64').toString();
|
|
166
|
-
|
|
168
|
+
assert.deepEqual(JSON.parse(body), {
|
|
167
169
|
tiles: [`https://tiles.test/v1/tiles/fake-vector/NZTM2000Quad/{z}/{x}/{y}.pbf?api=${Api.key}`],
|
|
168
170
|
maxzoom: 13,
|
|
169
171
|
minzoom: 0,
|