import {WFSDescribeFeatureTypeConverter} from 'dasf-web/lib/map/model/ogcservice/WFSDescribeFeatureTypeConverter';
import fs from 'fs';



    let cut: WFSDescribeFeatureTypeConverter = new WFSDescribeFeatureTypeConverter();

    test.skip('test load describeFeatureType document', async() =>{
        var url: string = "http://rz-vm154.gfz-potsdam.de:8080/geoserver/digitalearth/wfs";
        var category: string = "vgi_flood";
        var doc: XMLDocument = await cut.loadDescribeFeatureDocument(url, category);

        let featureElements: Array<[String, String]> = cut.getFeatureElements(doc, "vgi_floodType");
        expect(14).toEqual(featureElements.length);
    });

    test('test de-vgi_floodType Element List', async () =>{
        var doc = await readGFZExample();
        let featureElements: Array<[String, String]> = cut.getFeatureElements(doc, "digitalearth:vgi_flood");
        expect(14).toEqual(featureElements.length);
    });

    test('test koeln-biome06kaType Element List', async () =>{
        var doc = await readKoelnExample();
        let featureElements: Array<[String, String]> = cut.getFeatureElements(doc, "biome06ka");
        expect(10).toEqual(featureElements.length);
    });

    async function readGFZExample(): Promise<XMLDocument>{
        var text = fs.readFileSync('./tests/assets/dewfsDescribeFeatureType100.xml', 'utf-8');
        var oParse = new DOMParser();
        var doc: XMLDocument = oParse.parseFromString(text,'application/xml');
        return doc;
    }

    async function readKoelnExample(): Promise<XMLDocument>{
        var text = fs.readFileSync('./tests/assets/koelnWFSDescribeFeatureType.xml', 'utf-8');
        var oParse = new DOMParser();
        var doc: XMLDocument = oParse.parseFromString(text,'application/xml');
        return doc;
    }
});