-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from geodatagouv/tusbar/fix-service-coupled-re…
…sources Fix coupled resources extraction
- Loading branch information
Showing
5 changed files
with
226 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`lib.metadata.iso.index convert() extract featureTypes from a service metadata 1`] = ` | ||
Object { | ||
"alternateTitle": undefined, | ||
"contacts": Array [], | ||
"description": undefined, | ||
"featureTypes": Array [ | ||
Object { | ||
"relatedTo": "7bcc8a8723759135feb7040380a2f2d7c921280f", | ||
"serviceURL": "https://example.com/wfs", | ||
"typeName": "bati_avap_paimpol", | ||
}, | ||
Object { | ||
"relatedTo": "46a8d50322e881fd4e8b7abc3bc45c38a247532e", | ||
"serviceURL": "https://example.com/wfs", | ||
"typeName": "elr_avap_paimpol", | ||
}, | ||
], | ||
"id": undefined, | ||
"keywords": Array [], | ||
"metadataType": "ISO 19139", | ||
"resourceId": undefined, | ||
"serviceProtocol": "wfs", | ||
"serviceType": "download", | ||
"serviceURL": "https://example.com/wfs", | ||
"title": undefined, | ||
"type": "service", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`lib.metadata.iso.services getCoupledResources() should dedup duplicated coupled resources 1`] = ` | ||
Array [ | ||
Object { | ||
"identifier": "9fd801e3-976a-49b6-b84a-0bd448fec8d5", | ||
"scopedName": "bati_avap_paimpol", | ||
}, | ||
Object { | ||
"identifier": "e3b34f32-8081-4451-83e0-4d5fcfd36512", | ||
"scopedName": "elr_avap_paimpol", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`lib.metadata.iso.services getCoupledResources() should ignore incomplete resources 1`] = ` | ||
Array [ | ||
Object { | ||
"identifier": "foo2", | ||
"scopedName": "feature_type-2", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`lib.metadata.iso.services getCoupledResources() should return the coupled resources 1`] = ` | ||
Array [ | ||
Object { | ||
"identifier": "foo1", | ||
"scopedName": "feature_type-1", | ||
}, | ||
Object { | ||
"identifier": "foo2", | ||
"scopedName": "feature_type-2", | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const {convert} = require('../../../../lib/metadata/iso') | ||
|
||
describe('lib.metadata.iso.index', () => { | ||
describe('convert()', () => { | ||
it('extract featureTypes from a service metadata', () => { | ||
expect(convert({ | ||
hierarchyLevel: 'service', | ||
identificationInfo: { | ||
serviceType: 'download', | ||
coupledResource: [ | ||
{ | ||
operationName: 'GetCapabilities', | ||
identifier: '9fd801e3-976a-49b6-b84a-0bd448fec8d5', | ||
scopedName: 'bati_avap_paimpol' | ||
}, | ||
{ | ||
operationName: 'DescribeFeatureType', | ||
identifier: '9fd801e3-976a-49b6-b84a-0bd448fec8d5', | ||
scopedName: 'bati_avap_paimpol' | ||
}, | ||
{ | ||
operationName: 'GetFeature', | ||
identifier: '9fd801e3-976a-49b6-b84a-0bd448fec8d5', | ||
scopedName: 'bati_avap_paimpol' | ||
}, | ||
{ | ||
operationName: 'GetCapabilities', | ||
identifier: 'e3b34f32-8081-4451-83e0-4d5fcfd36512', | ||
scopedName: 'elr_avap_paimpol' | ||
}, | ||
{ | ||
operationName: 'DescribeFeatureType', | ||
identifier: 'e3b34f32-8081-4451-83e0-4d5fcfd36512', | ||
scopedName: 'elr_avap_paimpol' | ||
} | ||
] | ||
}, | ||
distributionInfo: { | ||
transferOptions: [ | ||
{ | ||
onLine: [ | ||
{ | ||
linkage: 'https://example.com/wfs?SERVICE=WFS&REQUEST=GetCapabilities&', | ||
protocol: 'OGC:WFS-2.0.0-http-get-capabilities' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
})).toMatchSnapshot() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters