Skip to content

Commit

Permalink
Merge upstream/main renaming of principal repo
Browse files Browse the repository at this point in the history
Add spearfish.pmtiles data file to test infrastructure
Add test dependency on serve-static so that test server supports byte
range request, a requirement of protomaps-leaflet
Add aliased version of pmtilesRules.js to test infrastructure so that
tests and dev code are not mixed up
  • Loading branch information
prushforth committed Aug 23, 2024
1 parent 082db4f commit 0603cc8
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 16 deletions.
19 changes: 10 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"proj4": "^2.6.2",
"proj4leaflet": "^1.0.2",
"protomaps-leaflet": "4.0.0",
"rollup": "^2.23.1"
"rollup": "^2.23.1",
"serve-static": "^1.15.0"
},
"files": [
"dist",
Expand Down
4 changes: 0 additions & 4 deletions src/pmtilesRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ pmtilesRules.set(
'https://api.protomaps.com/tiles/v3/{bing}/{bong}/{bang}.mvt?key=41392fb7515533a5',
{ theme: { theme: 'light' } }
);
pmtilesRules.set(
'http://localhost:30001/tiles/osmtile/{beans}/{foo}/{bar}.mvt?theme=light',
{ theme: { theme: 'light' } }
);
pmtilesRules.set(
'http://localhost:8080/geoserver/gwc/service/wmts/rest/spearfish/OSMTILE/{foo}/{baz}/{bar}?format=application/vnd.mapbox-vector-tile',
{
Expand Down
Binary file added test/e2e/layers/spearfish.pmtiles
Binary file not shown.
8 changes: 8 additions & 0 deletions test/e2e/layers/templatedPMTilesMVTLayer.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
<map-link rel="tile" tref="https://tile.openstreetmap.org/{z}/{x}/{y}.png"></map-link>
</map-extent>
</layer->-->
<layer->
<map-title>PMTiles test dark</map-title>
<map-link rel="license" title="© OpenStreetMap contributors CC BY-SA" href="https://www.openstreetmap.org/copyright"></map-link>
<map-extent units="OSMTILE" checked>
<map-meta name="extent" content="top-left-easting=-11563967, top-left-northing=5549940, bottom-right-easting=-11534883, bottom-right-northing=5516384"></map-meta>
<map-link rel="tile" type="application/pmtiles" tref="spearfish.pmtiles?theme=dark"></map-link>
</map-extent>
</layer->
<layer- checked>
<map-title>{z}/{x}/{y}.mvt test</map-title>
<map-extent units="OSMTILE" checked="checked">
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/layers/templatedPMTilesMVTLayer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ test.describe('Playwright templatedPMTilesLayer Tests', () => {
maxDiffPixels: 1500
});
});
test('Define what should happen if no pmtilesStyles.js module available', () => {
test.fail();
});
test('A protomaps map-link in a non-OSMTILE map-extent is never enabled', () => {
test.fail();
});
test('A protomaps map-link is disabled when out of bounds', () => {
test('A protomaps map-link, parent map-extent and ancestor layer- are disabled when out of bounds', () => {
test.fail();
});
test('A protomaps mvt map-link that has {z},{x},{y} variable names but no associated map-inputs will render', () => {
Expand Down
9 changes: 9 additions & 0 deletions test/e2e/layers/templatedPMTilesPmtilesRules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const pmtilesRules = new Map();
pmtilesRules.set('http://localhost:30001/spearfish.pmtiles?theme=dark', {
theme: { theme: 'dark' }
});
pmtilesRules.set(
'http://localhost:30001/tiles/osmtile/{beans}/{foo}/{bar}.mvt?theme=light',
{ theme: { theme: 'light' } }
);
export { pmtilesRules };
11 changes: 10 additions & 1 deletion test/server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
const express = require('express');
const app = express();
const path = require('path');
const serveStatic = require('serve-static');
const port = 30001;

// this must be setup first to prevent pmtilesRules.js in dist from superceding
// the test file (aliased to "pmtilesRules.js", per our required API to support
// protomaps-leaflet rule sets
app.get('/pmtilesRules.js', (req, res, next) => {
res.sendFile(__dirname + '/e2e/layers/templatedPMTilesPmtilesRules.js');
});

//then loads in the index file
app.use(express.static(path.join(__dirname, '../dist')));
app.use(express.static(path.join(__dirname, 'e2e/core')));
Expand All @@ -18,7 +26,8 @@ app.use(express.static(path.join(__dirname, 'e2e/elements/layer-')));
app.use(express.static(path.join(__dirname, 'e2e/api')));
app.use(express.static(path.join(__dirname, 'e2e/data')));
app.use(express.static(path.join(__dirname, 'e2e/geojson')));
app.use(express.static(path.join(__dirname, 'e2e/layers')));
// serveStatic enables byte range requests, only required on this directory
app.use(serveStatic(path.join(__dirname, 'e2e/layers')));
app.use(express.static(path.join(__dirname, 'e2e/mapml-viewer')));
app.use(express.static(path.join(__dirname, 'e2e/web-map')));

Expand Down

0 comments on commit 0603cc8

Please sign in to comment.