mirror of
https://forge.chapril.org/tykayn/libre-charge-map
synced 2025-06-20 01:34:43 +02:00
testing colors
This commit is contained in:
parent
be0ea5263c
commit
bdd0aaaba2
3 changed files with 73 additions and 10 deletions
|
@ -40,6 +40,56 @@ describe('testing on features', () => {
|
|||
let color = colorUtils.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)
|
||||
expect(outputFound).toEqual(3)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.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)
|
||||
expect(outputFound).toEqual(20)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.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)
|
||||
expect(outputFound).toEqual(50)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.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)
|
||||
expect(outputFound).toEqual(100)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.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)
|
||||
expect(outputFound).toEqual(200)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.colors[4])
|
||||
})
|
||||
it('finds 4nd color for 300 kW', () => {
|
||||
let localFeature = Object.create(featureWithOutput)
|
||||
localFeature.properties.tags['socket:type2:output'] = "300 kW"
|
||||
let outputFound = utils.guessOutputPowerFromFeature(featureWithOutput)
|
||||
expect(outputFound).toEqual(300)
|
||||
let color = colorUtils.getColor(localFeature)
|
||||
expect(color).toEqual(colorUtils.colors[5])
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue