mirror of
https://forge.chapril.org/tykayn/wololo
synced 2025-06-20 01:34:42 +02:00
add tests and failsafe for values true and false
This commit is contained in:
parent
5b0271716c
commit
cb6075fc61
10 changed files with 376 additions and 230 deletions
|
@ -70,6 +70,10 @@ export const mappingBoolean: MappingConfigType = {
|
|||
consolidated_is_lon_lat_correct: {
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
prise_type_chademo: {
|
||||
key_converted: 'socket:chademo',
|
||||
convert_to_boolean_value: true,
|
||||
},
|
||||
},
|
||||
add_not_mapped_tags_too: false,
|
||||
source: {
|
||||
|
|
|
@ -21,6 +21,26 @@
|
|||
"osm_id": 1234567890,
|
||||
"non_spécifié": "non spécifié"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
4.822159,
|
||||
45.635079
|
||||
]
|
||||
},
|
||||
"properties": {
|
||||
"boolean_enum": "True;false",
|
||||
"boolean_simple": "True",
|
||||
"boolean_simple_false": "False",
|
||||
"boolean_simple_false_uppercase": "FALSE",
|
||||
"boolean_simple_true": "TRUE",
|
||||
"boolean_simple_one": "1",
|
||||
"boolean_simple_zero": "0",
|
||||
"id": "0000002"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -83,19 +83,19 @@ describe('convert boolean keys', () => {
|
|||
expect(mapped_point.properties).toStrictEqual({ consolidated_is_lon_lat_correct: 'yes' })
|
||||
})
|
||||
|
||||
// test('ignore one value if it is truthy', () => {
|
||||
// let Mapping_engine = new MappingEngine(mappings.mappingIgnoreTruthy)
|
||||
// Mapping_engine.setConfig(mappings.mappingIgnoreTruthy)
|
||||
// let feature_to_test = testingGeoJson.features[0]
|
||||
// let mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
|
||||
// expect(mapped_point.properties).toStrictEqual({})
|
||||
// })
|
||||
// test('ignore one value if it is falsy', () => {
|
||||
// let Mapping_engine = new MappingEngine(mappings.mappingIgnoreFalsy)
|
||||
// let feature_to_test = testingGeoJson.features[0]
|
||||
// let mapped_point = Mapping_engine.mapElementFromConf(feature_to_test)
|
||||
// expect(mapped_point.properties).toStrictEqual({})
|
||||
// })
|
||||
test('no result with enum transform', () => {
|
||||
// on ne doit rien garder en cas d'énumération dans une propriété censée être booléenne si elle est une énumération
|
||||
expect(utils.convertToYesOrNo("True;FALSE")).toStrictEqual('')
|
||||
})
|
||||
|
||||
test('no result with simple transform', () => {
|
||||
expect(utils.convertToYesOrNo("1")).toStrictEqual('yes')
|
||||
})
|
||||
|
||||
test('no result with simple transform', () => {
|
||||
expect(utils.convertToYesOrNo("False")).toStrictEqual('no')
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
describe('ignore points having osm id', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue