import utils from '../js/utils' import colorUtils from '../js/color-utils' describe('testing on features', () => { const featureWithOutput = { properties: { tags: { 'socket:type2:output': '30 kW' } } } const featureWithBadOutput = { properties: { tags: { 'socket:type2:output': '50000' } } } const featureWithoutOutput = { properties: { tags: { 'socket:type2': '2' } } } describe('testing outputPower', () => { it('finds max outputpower when existing', () => { let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput) expect(outputFound).toEqual(30) }) }) describe('testing corresponding color', () => { it('finds undefined color', () => { let color = colorUtils.getColor(featureWithoutOutput) expect(color).toEqual('#c0b1b1') }) it('finds bad color', () => { let color = colorUtils.getColor(featureWithBadOutput) expect(color).toEqual('#ff1414') }) }) })