diff --git a/src/format-engine/measures/downloadExtensionMeasure.ts b/src/format-engine/measures/downloadExtensionMeasure.ts index d6d0248..ac1f5ae 100644 --- a/src/format-engine/measures/downloadExtensionMeasure.ts +++ b/src/format-engine/measures/downloadExtensionMeasure.ts @@ -6,14 +6,13 @@ const URL_REGEXES: Array<[RegExp, string]> = [ [new RegExp(".*\\?.*service=wms.*", "i"), "WMS"], [new RegExp(".*\\?.*service=wfs.*", "i"), "WFS"], [new RegExp("\\W+MapServer\\W*", "i"), "ESRI MAPSERVER"], - // ESRI FeatureServer Group We will set as "ESRI MAPSERVER" for now: https://github.com/magda-io/magda-minion-format/issues/8 + // ESRI FeatureServer We will set as "ESRI MAPSERVER" for now: https://github.com/magda-io/magda-minion-format/issues/8 [ - new RegExp("(\\W+FeatureServer)|(\\W+FeatureServer/)$", "i"), + new RegExp("(\\W+FeatureServer$)|(\\W+FeatureServer/)", "i"), "ESRI MAPSERVER" ], - [new RegExp("\\W+FeatureServer/d", "i"), "ESRI MAPSERVER"], // ESRI FeatureServer [ - new RegExp("(\\W+SceneServer)|(\\W+SceneServer/)$", "i"), + new RegExp("(\\W+SceneServer$)|(\\W+SceneServer/)", "i"), "ESRI SCENESERVER" ], // ESRI SceneServer [new RegExp(".*\\.(shp|shz|dbf)(\\.zip)?$", "i"), "SHP"], diff --git a/src/test/onRecordFound.spec.ts b/src/test/onRecordFound.spec.ts index 862c879..8eb9108 100644 --- a/src/test/onRecordFound.spec.ts +++ b/src/test/onRecordFound.spec.ts @@ -142,6 +142,11 @@ describe("onRecordFound", async function(this) { "ESRI SCENESERVER" ); + testDistFileReturnsFormat( + "./sampleDataFiles/esri-sceneserver2.json", + "ESRI SCENESERVER" + ); + // we put as ESRI MAPSERVER for now see https://github.com/magda-io/magda-minion-format/issues/8 testDistFileReturnsFormat( "./sampleDataFiles/esri-featureserver-group1.json", diff --git a/src/test/sampleDataFiles/esri-sceneserver2.json b/src/test/sampleDataFiles/esri-sceneserver2.json new file mode 100644 index 0000000..b9415c0 --- /dev/null +++ b/src/test/sampleDataFiles/esri-sceneserver2.json @@ -0,0 +1,50 @@ +{ + "aspects": { + "source": { + "id": "nsw-ckan", + "name": "data.nsw.gov.au", + "type": "ckan-resource", + "url": "https://data.nsw.gov.au/data/api/3/action/resource_show?id=b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9" + }, + "ckan-resource": { + "cache_last_updated": null, + "cache_url": null, + "created": "2021-04-29T11:13:30", + "datastore_active": false, + "datastore_contains_all_records_of_source_file": false, + "format": "ARCGIS REST SERVICE", + "hash": "", + "id": "b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9", + "last_modified": null, + "metadata_modified": "2021-06-30T14:22:59.061057", + "mimetype": null, + "mimetype_inner": null, + "package_id": "b63902fd-ed0a-432e-b928-3e70eaac5daa", + "position": 0, + "resource_type": null, + "size": null, + "state": "active", + "url": "https://portal.spatial.nsw.gov.au/portal/sharing/servers/245813070a2e433ea385b709507643b6/rest/services/Hosted/CAMDEN_3D_STRATA_20210310/SceneServer/99", + "url_type": null + }, + "dcat-distribution-strings": { + "downloadURL": "https://portal.spatial.nsw.gov.au/portal/sharing/servers/245813070a2e433ea385b709507643b6/rest/services/Hosted/CAMDEN_3D_STRATA_20210310/SceneServer/99", + "format": "ARCGIS REST SERVICE", + "issued": "2021-04-29T11:13:30Z", + "license": "Creative Commons Attribution", + "title": "b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9" + }, + "source-link-status": { + "httpStatusCode": 200, + "status": "active" + }, + "dataset-format": { + "confidenceLevel": 33, + "format": "ARCGIS" + } + }, + "id": "dist-nsw-ckan-b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9", + "name": "b8ce96a0-ccd9-41b1-ab57-91585d4ea9c9", + "sourceTag": "eb74ae9c-a301-441b-857b-54d5db622d90", + "tenantId": 0 +}