Skip to content

Commit

Permalink
Added @mapbox/mvt-fixtures test-suite dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoabinader committed Feb 28, 2018
1 parent 4990bd8 commit bc57748
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
24 changes: 17 additions & 7 deletions test/integration/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ const colors = require('chalk');
const fs = require('fs');

module.exports = function () {
const server = http.createServer(st({path: path.join(__dirname, '..')}));
const integrationPath = st({path: path.join(__dirname, '..'), url: '/'});
const nodeModulesPath = st({path: path.join(__dirname, '../../../node_modules'), url: '/node_modules'});
const server = http.createServer((req, res) => {
return nodeModulesPath(req, res, () => { return integrationPath(req, res); });
});

function localURL(url) {
return url.replace(/^local:\/\//, 'http://localhost:2900/');
Expand Down Expand Up @@ -84,13 +88,19 @@ module.exports = function () {

// sources
for (const k in styleJSON.sources) {
const sourceName = clearMapboxProtocol(styleJSON.sources[k].url);
if (styleJSON.sources[k].type === 'vector') {
styleJSON.sources[k].tiles = [ `http\:\/\/localhost:2900/tiles/${sourceName}/{z}-{x}-{y}.mvt` ];
} else if (styleJSON.sources[k].type === 'raster') {
styleJSON.sources[k].tiles = [ `http\:\/\/localhost:2900/tiles/${sourceName}/{z}-{x}-{y}.png` ];
if (styleJSON.sources[k].url === undefined) {
for (const t in styleJSON.sources[k].tiles) {
styleJSON.sources[k].tiles[t] = localURL(styleJSON.sources[k].tiles[t]);
}
} else {
const sourceName = clearMapboxProtocol(styleJSON.sources[k].url);
if (styleJSON.sources[k].type === 'vector') {
styleJSON.sources[k].tiles = [ `http\:\/\/localhost:2900/tiles/${sourceName}/{z}-{x}-{y}.mvt` ];
} else if (styleJSON.sources[k].type === 'raster') {
styleJSON.sources[k].tiles = [ `http\:\/\/localhost:2900/tiles/${sourceName}/{z}-{x}-{y}.png` ];
}
delete styleJSON.sources[k].url;
}
delete styleJSON.sources[k].url;
}

// sprite
Expand Down
1 change: 1 addition & 0 deletions test/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "BSD",
"main": "index.js",
"dependencies": {
"@mapbox/mvt-fixtures": "^3.2.0",
"chalk": "^2.3.0",
"d3-queue": "^3.0.3",
"diff": "^3.0.0",
Expand Down
21 changes: 20 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"@mapbox/mapbox-gl-test-suite@file:test/integration":
version "0.0.0"
dependencies:
"@mapbox/mvt-fixtures" "^3.2.0"
chalk "^2.3.0"
d3-queue "^3.0.3"
diff "^3.0.0"
Expand All @@ -153,6 +154,16 @@
shuffle-seed "^1.1.6"
st "^1.1.0"

"@mapbox/mvt-fixtures@^3.2.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@mapbox/mvt-fixtures/-/mvt-fixtures-3.2.0.tgz#9312bfe1437f889cbc65a9d56efac02bbcb9a91d"
dependencies:
"@mapbox/sphericalmercator" "^1.0.5"
"@mapbox/vector-tile" "^1.3.0"
d3-queue "^3.0.7"
pbf "^3.0.5"
protocol-buffers-schema "^3.3.1"

"@mapbox/point-geometry@0.1.0", "@mapbox/point-geometry@^0.1.0", "@mapbox/point-geometry@~0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz#8a83f9335c7860effa2eeeca254332aa0aeed8f2"
Expand Down Expand Up @@ -181,6 +192,10 @@
version "3.1.0"
resolved "https://registry.yarnpkg.com/@mapbox/shelf-pack/-/shelf-pack-3.1.0.tgz#1edea9c0bf6715b217171ba60646c201af520f6a"

"@mapbox/sphericalmercator@^1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@mapbox/sphericalmercator/-/sphericalmercator-1.0.5.tgz#70237b9774095ed1cfdbcea7a8fd1fc82b2691f2"

"@mapbox/tiny-sdf@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@mapbox/tiny-sdf/-/tiny-sdf-1.1.0.tgz#b0b8f5c22005e6ddb838f421ffd257c1f74f9a20"
Expand Down Expand Up @@ -2870,7 +2885,7 @@ d3-quadtree@1, d3-quadtree@1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.3.tgz#ac7987e3e23fe805a990f28e1b50d38fcb822438"

d3-queue@3.0.7, d3-queue@^3.0.3:
d3-queue@3.0.7, d3-queue@^3.0.3, d3-queue@^3.0.7:
version "3.0.7"
resolved "https://registry.yarnpkg.com/d3-queue/-/d3-queue-3.0.7.tgz#c93a2e54b417c0959129d7d73f6cf7d4292e7618"

Expand Down Expand Up @@ -7972,6 +7987,10 @@ protocol-buffers-schema@^2.0.2:
version "2.2.0"
resolved "https://registry.yarnpkg.com/protocol-buffers-schema/-/protocol-buffers-schema-2.2.0.tgz#d29c6cd73fb655978fb6989691180db844119f61"

protocol-buffers-schema@^3.3.1:
version "3.3.2"
resolved "https://registry.yarnpkg.com/protocol-buffers-schema/-/protocol-buffers-schema-3.3.2.tgz#00434f608b4e8df54c59e070efeefc37fb4bb859"

protocols@^1.1.0, protocols@^1.4.0:
version "1.4.5"
resolved "https://registry.yarnpkg.com/protocols/-/protocols-1.4.5.tgz#21de1f441c4ef7094408ed9f1c94f7a114b87557"
Expand Down

0 comments on commit bc57748

Please sign in to comment.