From dd3123bbcf4a611aba018ee9e3712100f3a1cdce Mon Sep 17 00:00:00 2001 From: panaaj <38519157+panaaj@users.noreply.github.com> Date: Sat, 28 Sep 2024 16:47:54 +0930 Subject: [PATCH] Update tests. --- test/expected-charts.json | 6 +++--- test/plugin-test.js | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/test/expected-charts.json b/test/expected-charts.json index 5c8b180..46984ba 100644 --- a/test/expected-charts.json +++ b/test/expected-charts.json @@ -14,7 +14,7 @@ "minzoom": 3, "name": "MBTILES_19", "scale": 250000, - "tilemapUrl": "/signalk/v1/api/resources/charts/test/{z}/{x}/{y}", + "tilemapUrl": "http://localhost:3000/chart-tiles/test/{z}/{x}/{y}", "type": "tilelayer" }, "tms-tiles": { @@ -32,7 +32,7 @@ "minzoom": 4, "name": "Översikt Svenska Sjökort", "scale": 4000000, - "tilemapUrl": "/signalk/v1/api/resources/charts/tms-tiles/{z}/{x}/{y}", + "tilemapUrl": "http://localhost:3000/chart-tiles/tms-tiles/{z}/{x}/{y}", "type": "tilelayer" }, "unpacked-tiles": { @@ -50,7 +50,7 @@ "minzoom": 3, "name": "NOAA MBTiles test file", "scale": 250000, - "tilemapUrl": "/signalk/v1/api/resources/charts/unpacked-tiles/{z}/{x}/{y}", + "tilemapUrl": "http://localhost:3000/chart-tiles/unpacked-tiles/{z}/{x}/{y}", "type": "tilelayer" } } \ No newline at end of file diff --git a/test/plugin-test.js b/test/plugin-test.js index f9bcfa5..63a0027 100644 --- a/test/plugin-test.js +++ b/test/plugin-test.js @@ -109,7 +109,8 @@ describe('GET /resources/charts', () => { }) -describe('GET /resources/charts/:identifier/:z/:x/:y', () => { + +describe('GET /chart-tiles/:identifier/:z/:x/:y', () => { let plugin let testServer beforeEach(() => @@ -123,7 +124,7 @@ describe('GET /resources/charts/:identifier/:z/:x/:y', () => { it('returns correct tile from MBTiles file', () => { return plugin.start({}) - .then(() => get(testServer, '/signalk/v1/api/resources/charts/test/4/5/6')) + .then(() => get(testServer, '/chart-tiles/test/4/5/6')) .then(response => { // unpacked-tiles contains same tiles as the test.mbtiles file expectTileResponse(response, 'charts/unpacked-tiles/4/5/6.png', 'image/png') @@ -133,7 +134,7 @@ describe('GET /resources/charts/:identifier/:z/:x/:y', () => { it('returns correct tile from directory', () => { const expectedTile = fs.readFileSync(path.resolve(__dirname, 'charts/unpacked-tiles/4/4/6.png')) return plugin.start({}) - .then(() => get(testServer, '/signalk/v1/api/resources/charts/unpacked-tiles/4/4/6')) + .then(() => get(testServer, '/chart-tiles/unpacked-tiles/4/4/6')) .then(response => { expectTileResponse(response, 'charts/unpacked-tiles/4/4/6.png', 'image/png') }) @@ -143,7 +144,7 @@ describe('GET /resources/charts/:identifier/:z/:x/:y', () => { const expectedTile = fs.readFileSync(path.resolve(__dirname, 'charts/tms-tiles/5/17/21.png')) // Y-coordinate flipped return plugin.start({}) - .then(() => get(testServer, '/signalk/v1/api/resources/charts/tms-tiles/5/17/10')) + .then(() => get(testServer, '/chart-tiles/tms-tiles/5/17/10')) .then(response => { expectTileResponse(response, 'charts/tms-tiles/5/17/21.png', 'image/png') }) @@ -151,7 +152,7 @@ describe('GET /resources/charts/:identifier/:z/:x/:y', () => { it('returns 404 for missing tile', () => { return plugin.start({}) - .then(() => get(testServer, '/signalk/v1/api/resources/charts/tms-tiles/5/55/10')) + .then(() => get(testServer, '/chart-tiles/tms-tiles/5/55/10')) .catch(e => e.response) .then(response => { expect(response.status).to.equal(404) @@ -160,7 +161,7 @@ describe('GET /resources/charts/:identifier/:z/:x/:y', () => { it('returns 404 for wrong chart identifier', () => { return plugin.start({}) - .then(() => get(testServer, '/signalk/v1/api/resources/charts/foo/4/4/6')) + .then(() => get(testServer, '/chart-tiles/foo/4/4/6')) .catch(e => e.response) .then(response => { expect(response.status).to.equal(404)