import mapping_engine from '../mappings/engine.ts' import { mappingRemoveAll, mappingSame, mappingPhone, mappingName } from '../data_other/testing/mappings_to_test' import MappingConfigType, {BoundingBoxCoordinatesType, FeatureCollection} from "../mappings/mapping-config.type"; const testingGeoJson = require('../data_other/testing/testing.json') // import { describe, expect, test } from '@jest/globals' describe('mapping properties with rich mapping engine', () => { // test('do not add properties at all when there is nothing in tags of the mapping config', () => { // // }) let feature_to_test = testingGeoJson.features[0]; test('remove all properties when mapping says so', () => { let Mapping_engine = new mapping_engine(mappingRemoveAll) let mapped_point = Mapping_engine.mapElementFromConf(feature_to_test) expect(mapped_point).toBeTruthy() expect(Object.keys(mapped_point.properties)).toStrictEqual([]) }) // test('maps simple key to key, and keep the same value', () => { // let Mapping_engine = new mapping_engine(mappingSame) // let mapped_point = Mapping_engine.mapElementFromConf(feature_to_test) // console.log('mapped_point', mapped_point) // expect(mapped_point.properties).toBe({ // equal : "same value" // }) // }) test('retrieve config name in mapping engine', () => { let Mapping_engine = new mapping_engine(mappingRemoveAll) expect(Mapping_engine.getConfig().config_name).toBe('testing config mappingRemoveAll') }) test('maps nom_amenageur to name, and keep the same value', () => { let Mapping_engine = new mapping_engine(mappingName) let mapped_point = Mapping_engine.mapElementFromConf(feature_to_test) expect(Mapping_engine.getConfig().config_name).toBe('testing config mappingName') expect(mapped_point).toBe({ name : "Bob" }) }) // test('ignore one value', () => { }) // test('conditional value', () => { }) // test('conditional transform', () => { }) // test('conditional truthy transform', () => { }) // test('conditional falsy transform', () => { }) // test('conditional phone transform', () => { // let Mapping_engine = new mapping_engine(mappingPhone) // let mapped_point = Mapping_engine.mapElementFromConf(feature_to_test) // expect(mapped_point.properties).toBe({phone:'+33123456789'}) // }) }) xdescribe('filters points', () => { test('filter no points', () => { }) test('filter only one point', () => { }) test('filter X number of points', () => { }) test('filter city points', () => { }) test('filter bounding box', () => { }) test('filter combo, city', () => { }) test('filter combo, city + bbox', () => { }) test('filter combo, city + bbox + offset', () => { }) }) /** * thats a roadmap, yes */ xdescribe('infer domain of values from csv file', () => { test('gets the list of unique values in column', () => { }) }) xdescribe('infer domain of values from geojson file', () => { test('gets the list of unique values in column', () => { }) }) xdescribe('build mapping engine config from unique values', () => { test('builds a valid mapping config', () => { }) })