Skip to content

Commit

Permalink
refactor(test): move test colorLayer to own test file
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Sep 25, 2024
1 parent a28622b commit b48a6cf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
37 changes: 37 additions & 0 deletions test/unit/colorlayer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import assert from 'assert';
import ColorLayer from 'Layer/ColorLayer';
import GlobeView from 'Core/Prefab/GlobeView';
import FileSource from 'Source/FileSource';
import Coordinates from 'Core/Geographic/Coordinates';
import HttpsProxyAgent from 'https-proxy-agent';
import Renderer from './bootstrap';

describe('ColorLayer', function () {
const renderer = new Renderer();
const placement = { coord: new Coordinates('EPSG:4326', 1.5, 43), range: 300000 };
const viewer = new GlobeView(renderer.domElement, placement, { renderer });

const source = new FileSource({
url: 'https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements/09-ariege/departement-09-ariege.geojson',
crs: 'EPSG:4326',
format: 'application/json',
networkOptions: process.env.HTTPS_PROXY ? { agent: new HttpsProxyAgent(process.env.HTTPS_PROXY) } : {},
});

const ariege = new ColorLayer('ariege', {
transparent: true,
style: {
fill: { color: 'blue', opacity: 0.8 },
stroke: { color: 'black', width: 1.0 },
},
source,
zoom: { min: 11 },
});
viewer.addLayer(ariege);

it('invalidate cache', function () {
ariege.invalidateCache();
assert.equal(ariege.parent.level0Nodes[0].redraw, true);
assert.equal(ariege.parent.level0Nodes[0].layerUpdateState[ariege.id], undefined);
});
});
35 changes: 0 additions & 35 deletions test/unit/layer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import assert from 'assert';
import Layer, { ImageryLayers } from 'Layer/Layer';
import ColorLayer from 'Layer/ColorLayer';
import GlobeView from 'Core/Prefab/GlobeView';
import FileSource from 'Source/FileSource';
import Coordinates from 'Core/Geographic/Coordinates';
import HttpsProxyAgent from 'https-proxy-agent';
import Renderer from './bootstrap';

describe('Layer', function () {
it('should emit an event on property changed', function () {
Expand Down Expand Up @@ -72,33 +67,3 @@ describe('ImageryLayers', function () {
assert.throws(() => new ColorLayer('id'), /^Error: Layer id needs Source$/);
});
});

describe('ColorLayer', function () {
const renderer = new Renderer();
const placement = { coord: new Coordinates('EPSG:4326', 1.5, 43), range: 300000 };
const viewer = new GlobeView(renderer.domElement, placement, { renderer });

const source = new FileSource({
url: 'https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements/09-ariege/departement-09-ariege.geojson',
crs: 'EPSG:4326',
format: 'application/json',
networkOptions: process.env.HTTPS_PROXY ? { agent: new HttpsProxyAgent(process.env.HTTPS_PROXY) } : {},
});

const ariege = new ColorLayer('ariege', {
transparent: true,
style: {
fill: { color: 'blue', opacity: 0.8 },
stroke: { color: 'black', width: 1.0 },
},
source,
zoom: { min: 11 },
});
viewer.addLayer(ariege);

it('invalidate cache', function () {
ariege.invalidateCache();
assert.equal(ariege.parent.level0Nodes[0].redraw, true);
assert.equal(ariege.parent.level0Nodes[0].layerUpdateState[ariege.id], undefined);
});
});

0 comments on commit b48a6cf

Please sign in to comment.