import { Converter, PROJECTION_AUTO_DETECT } from './converter'; import fs from 'fs'; import path from 'path'; const tests = [ { path: 'testdata/PS619178.xml', opts: { projection: PROJECTION_AUTO_DETECT } }, { path: 'testdata/VENAREY.xml', opts: { projection: 'EPSG:3947' } }, { path: 'testdata/PLAN_EXE_ind4_10.10.2019.xml', opts: { projection: 'EPSG:3947' } }, { path: 'testdata/CHAZILLY_PLAN_EXE_ind1_DU_10.10.19.xml', opts: { projection: 'EPSG:3947' } }, { path: 'testdata/AS24_PLAN_EXE_IND_1_10.10.2019.xml', opts: { projection: 'EPSG:3947' } } ]; describe('test landxml conversion to geojson', () => { tests.forEach(entry => { (function(entry) { test(`'${entry.path}'`, () => { const converter = new Converter(); const filepath = path.join(__dirname, entry.path); const data = fs.readFileSync(filepath, {encoding: 'utf8'}); return converter.toGeoJSON(data, entry.opts) .then(geojson => { expect(geojson).not.toBeFalsy(); expect(geojson.type).toBe("FeatureCollection"); expect(geojson.features).not.toBeUndefined(); expect(geojson.features.length).toBeGreaterThan(0); }) ; }); })(entry); }); });