Skip to content

Commit

Permalink
Merge d1381eb into 0e3d822
Browse files Browse the repository at this point in the history
  • Loading branch information
hwbllmnn committed Feb 5, 2019
2 parents 0e3d822 + d1381eb commit fe80752
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
language: node_js
node_js:
- "8"
- "10"
- "8"
- "10"
before_install:
- sudo apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
addons:
apt:
update: true
script:
- npm run test
- npm run test
after_success:
- npm run-script coveralls
- npm run-script coveralls
cache:
directories:
- node-modules
- node-modules
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
"babel-loader": "8.0.5",
"babel-plugin-dynamic-import-node": "2.2.0",
"babel-plugin-import": "1.11.0",
"canvas": "2.0.0-alpha.1",
"coveralls": "3.0.2",
"d3": "5.8.2",
"eslint": "5.13.0",
"geostyler-openlayers-parser": "1.0.0",
"jest": "24.0.0",
"jsdom": "13.2.0",
"np": "4.0.2",
"ol": "5.3.0",
"rimraf": "2.6.3",
Expand Down
37 changes: 37 additions & 0 deletions src/LegendRenderer/LegendRenderer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,41 @@ describe('LegendRenderer', () => {
expect(LegendRenderer).not.toBeUndefined();
});

it('can be constructed', () => {
const renderer = new LegendRenderer();
expect(renderer).not.toBeUndefined();
});

it('can convert config objects', () => {
const renderer = new LegendRenderer();
const config = renderer.extractConfigFromStyle({
rules: [{
name: 'Legend item 1'
}],
name: 'Legend 1'
});
expect(config.title).toBe('Legend 1');
expect(config.items[0].title).toBe('Legend item 1');
});

it('can convert config objects without style name', () => {
const renderer = new LegendRenderer();
const config = renderer.extractConfigFromStyle({
rules: [{
name: 'Legend item 1'
}]
});
expect(config.title).toBe(undefined);
});

it('will not throw when constructing a rule icon', () => {
const renderer = new LegendRenderer();
expect(() => renderer.getRuleIcon({
symbolizers: [{
kind: 'Mark',
wellKnownName: 'Circle'
}]
})).not.toThrow();
});

});

0 comments on commit fe80752

Please sign in to comment.