mirror of
https://forge.chapril.org/tykayn/libre-charge-map
synced 2025-10-04 17:04:53 +02:00
refacto naming exports js librechargemap with lcm_ prefix
This commit is contained in:
parent
7100bc1d52
commit
c194a858b1
8 changed files with 110 additions and 95 deletions
|
@ -1,5 +1,5 @@
|
|||
import utils from '../js/utils'
|
||||
import colorUtils from '../js/color-utils'
|
||||
import lcm_utils from '../js/lcm_utils'
|
||||
import lcm_color_utils from '../js/lcm_color_utils'
|
||||
|
||||
describe('testing on features', () => {
|
||||
const featureWithOutput = {
|
||||
|
@ -26,68 +26,68 @@ describe('testing on features', () => {
|
|||
|
||||
describe('testing outputPower', () => {
|
||||
it('finds max outputpower when existing', () => {
|
||||
let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
let outputFound = lcm_utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
expect(outputFound).toEqual(30)
|
||||
})
|
||||
})
|
||||
describe('testing corresponding color', () => {
|
||||
|
||||
it('finds undefined color', () => {
|
||||
let color = colorUtils.getColor(featureWithoutOutput)
|
||||
let color = lcm_color_utils.getColor(featureWithoutOutput)
|
||||
expect(color).toEqual('#c0b1b1')
|
||||
})
|
||||
it('finds bad color', () => {
|
||||
let color = colorUtils.getColor(featureWithBadOutput)
|
||||
let color = lcm_color_utils.getColor(featureWithBadOutput)
|
||||
expect(color).toEqual('#ff1414')
|
||||
})
|
||||
|
||||
it('finds first color for 3 kW', () => {
|
||||
let localFeature = Object.create(featureWithOutput)
|
||||
localFeature.properties.tags['socket:type2:output'] = "3 kW"
|
||||
let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
let outputFound = lcm_utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
expect(outputFound).toEqual(3)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.colors[0])
|
||||
let color = lcm_color_utils.getColor(localFeature)
|
||||
expect(color).toEqual(lcm_color_utils.colors[0])
|
||||
})
|
||||
it('finds 2nd color for 20 kW', () => {
|
||||
let localFeature = Object.create(featureWithOutput)
|
||||
localFeature.properties.tags['socket:type2:output'] = "20 kW"
|
||||
let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
let outputFound = lcm_utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
expect(outputFound).toEqual(20)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.colors[1])
|
||||
let color = lcm_color_utils.getColor(localFeature)
|
||||
expect(color).toEqual(lcm_color_utils.colors[1])
|
||||
})
|
||||
it('finds 3nd color for 50 kW', () => {
|
||||
let localFeature = Object.create(featureWithOutput)
|
||||
localFeature.properties.tags['socket:type2:output'] = "50 kW"
|
||||
let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
let outputFound = lcm_utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
expect(outputFound).toEqual(50)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.colors[2])
|
||||
let color = lcm_color_utils.getColor(localFeature)
|
||||
expect(color).toEqual(lcm_color_utils.colors[2])
|
||||
})
|
||||
it('finds 3nd color for 100 kW', () => {
|
||||
let localFeature = Object.create(featureWithOutput)
|
||||
localFeature.properties.tags['socket:type2:output'] = "100 kW"
|
||||
let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
let outputFound = lcm_utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
expect(outputFound).toEqual(100)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.colors[3])
|
||||
let color = lcm_color_utils.getColor(localFeature)
|
||||
expect(color).toEqual(lcm_color_utils.colors[3])
|
||||
})
|
||||
it('finds 4nd color for 200 kW', () => {
|
||||
let localFeature = Object.create(featureWithOutput)
|
||||
localFeature.properties.tags['socket:type2:output'] = "200 kW"
|
||||
let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
let outputFound = lcm_utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
expect(outputFound).toEqual(200)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.colors[4])
|
||||
let color = lcm_color_utils.getColor(localFeature)
|
||||
expect(color).toEqual(lcm_color_utils.colors[4])
|
||||
})
|
||||
it('finds 5th color for 300 kW', () => {
|
||||
let localFeature = Object.create(featureWithOutput)
|
||||
localFeature.properties.tags['socket:type2:output'] = "300 kW"
|
||||
let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
let outputFound = lcm_utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
expect(outputFound).toEqual(300)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.colors[5])
|
||||
let color = lcm_color_utils.getColor(localFeature)
|
||||
expect(color).toEqual(lcm_color_utils.colors[5])
|
||||
})
|
||||
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue