@@ -35,31 +35,56 @@ describe('indexCmrCollection handler', () => {
35
35
const platform1 = 'Platform One'
36
36
const instrument1 = 'Instrument One'
37
37
const platform2 = 'Platform Two'
38
- const docName = 'https://en.wikipedia.org/wiki/latent_nfi'
38
+ const relatedUrl = 'https://en.wikipedia.org/wiki/latent_nfi'
39
+ const doi = 'doi:10.16904/envidat.166'
39
40
40
41
await updateCollection (
41
42
conceptId ,
42
43
datasetTitle ,
43
44
{
44
45
campaigns : [ campaign1 ] ,
45
46
platforms : [ { platform : platform1 , instruments : [ instrument1 ] } , { platform : platform2 } ] ,
46
- docNames : [ docName ]
47
+ relatedUrls : [ relatedUrl ] ,
48
+ doi
47
49
}
48
50
)
49
51
50
52
await verifyCollectionPropertiesInGraphDb (
51
53
{
52
54
datasetTitle,
53
55
conceptId,
54
- doi : 'doi:10.16904/envidat.166'
56
+ doi
55
57
}
56
58
)
57
59
58
60
await verifyCampaignExistInGraphDb ( datasetTitle , campaign1 )
59
61
await verifyPlatformInstrumentsExistInGraphDb ( datasetTitle ,
60
62
{ platform : platform1 , instruments : [ instrument1 ] } )
61
63
await verifyPlatformInstrumentsExistInGraphDb ( datasetTitle , { platform : platform2 } )
62
- await verifyDocumentationExistInGraphDb ( datasetTitle , docName )
64
+ await verifyDocumentationExistInGraphDb ( datasetTitle , relatedUrl )
65
+ } )
66
+
67
+ test ( 'test indexing of a collection with no DOI value' , async ( ) => {
68
+ const datasetTitle = 'Latent reserves within the Swiss NFI'
69
+ const conceptId = 'C1237293909-TESTPROV'
70
+ const platform1 = 'Platform One'
71
+
72
+ await updateCollection (
73
+ conceptId ,
74
+ datasetTitle ,
75
+ {
76
+ platforms : [ { platform : platform1 } ]
77
+ }
78
+ )
79
+
80
+ await verifyCollectionPropertiesInGraphDb (
81
+ {
82
+ datasetTitle,
83
+ conceptId
84
+ }
85
+ )
86
+
87
+ await verifyPlatformInstrumentsExistInGraphDb ( datasetTitle , { platform : platform1 } )
63
88
} )
64
89
65
90
test ( 'test index of not found collection' , async ( ) => {
@@ -125,7 +150,7 @@ describe('indexCmrCollection handler', () => {
125
150
const instrument1 = 'Instrument One'
126
151
const instrument2 = 'Instrument Two'
127
152
const platform2 = 'Platform Two'
128
- const docName = 'https://en.wikipedia.org/wiki/latent_nfi'
153
+ const relatedUrl = 'https://en.wikipedia.org/wiki/latent_nfi'
129
154
130
155
// first index the collection and verify dataset and documentation vertices are created
131
156
await updateCollection (
@@ -136,23 +161,23 @@ describe('indexCmrCollection handler', () => {
136
161
platforms : [
137
162
{ platform : platform1 , instruments : [ instrument1 , instrument2 ] } ,
138
163
{ platform : platform2 } ] ,
139
- docNames : [ docName ]
164
+ relatedUrls : [ relatedUrl ]
140
165
}
141
166
)
142
167
143
168
await verifyCampaignExistInGraphDb ( datasetTitle , campaign1 )
144
169
await verifyPlatformInstrumentsExistInGraphDb ( datasetTitle ,
145
170
{ platform : platform1 , instruments : [ instrument1 , instrument2 ] } )
146
171
await verifyPlatformInstrumentsExistInGraphDb ( datasetTitle , { platform : platform2 } )
147
- await verifyDocumentationExistInGraphDb ( datasetTitle , docName )
172
+ await verifyDocumentationExistInGraphDb ( datasetTitle , relatedUrl )
148
173
149
174
// delete the collection and verify dataset and campaign/documentation vertices are deleted
150
175
await deleteCollection ( 'C1237293909-TESTPROV' )
151
176
await verifyCampaignNotExistInGraphDb ( datasetTitle , campaign1 )
152
177
await verifyPlatformInstrumentsNotExistInGraphDb ( datasetTitle ,
153
178
{ platform : platform1 , instruments : [ instrument1 , instrument2 ] } )
154
179
await verifyPlatformInstrumentsNotExistInGraphDb ( datasetTitle , { platform : platform2 } )
155
- await verifyDocumentationNotExistInGraphDb ( datasetTitle , docName )
180
+ await verifyDocumentationNotExistInGraphDb ( datasetTitle , relatedUrl )
156
181
} )
157
182
158
183
test ( 'test deletion collection not delete linked documentation vertex if it is also linked to another collection' , async ( ) => {
@@ -172,9 +197,9 @@ describe('indexCmrCollection handler', () => {
172
197
const ownInstrument = 'OwnInstrument'
173
198
174
199
// this documentation url is referenced by two collections
175
- const sharedDocName = 'https://en.wikipedia.org/wiki/latent_nfi'
200
+ const sharedDocUrl = 'https://en.wikipedia.org/wiki/latent_nfi'
176
201
// this documentation url is referenced only by one collection
177
- const ownDocName = 'https://en.wikipedia.org/wiki/latent_nfi2'
202
+ const ownDocUrl = 'https://en.wikipedia.org/wiki/latent_nfi2'
178
203
179
204
// first index the collection and verify dataset and campaign/documentation vertices are created
180
205
await updateCollection (
@@ -185,7 +210,7 @@ describe('indexCmrCollection handler', () => {
185
210
platforms : [
186
211
{ platform : sharedPlatform , instruments : [ sharedInstrument , ownInstrument ] } ,
187
212
{ platform : ownPlatform } ] ,
188
- docNames : [ sharedDocName , ownDocName ]
213
+ relatedUrls : [ sharedDocUrl , ownDocUrl ]
189
214
}
190
215
)
191
216
@@ -194,8 +219,8 @@ describe('indexCmrCollection handler', () => {
194
219
await verifyPlatformInstrumentsExistInGraphDb ( datasetTitle ,
195
220
{ platform : sharedPlatform , instruments : [ sharedInstrument , ownInstrument ] } )
196
221
await verifyPlatformInstrumentsExistInGraphDb ( datasetTitle , { platform : ownPlatform } )
197
- await verifyDocumentationExistInGraphDb ( datasetTitle , sharedDocName )
198
- await verifyDocumentationExistInGraphDb ( datasetTitle , ownDocName )
222
+ await verifyDocumentationExistInGraphDb ( datasetTitle , sharedDocUrl )
223
+ await verifyDocumentationExistInGraphDb ( datasetTitle , ownDocUrl )
199
224
200
225
// index a second collection that reference the same campaign/documentation vertex
201
226
// and verify dataset and campaign/documentation vertices are created
@@ -206,14 +231,14 @@ describe('indexCmrCollection handler', () => {
206
231
campaigns : [ sharedCampaign ] ,
207
232
platforms : [
208
233
{ platform : sharedPlatform , instruments : [ sharedInstrument ] } ] ,
209
- docNames : [ sharedDocName ]
234
+ relatedUrls : [ sharedDocUrl ]
210
235
}
211
236
)
212
237
213
238
await verifyCampaignExistInGraphDb ( anotherDatasetTitle , sharedCampaign )
214
239
await verifyPlatformInstrumentsExistInGraphDb ( anotherDatasetTitle ,
215
240
{ platform : sharedPlatform , instruments : [ sharedInstrument ] } )
216
- await verifyDocumentationExistInGraphDb ( anotherDatasetTitle , sharedDocName )
241
+ await verifyDocumentationExistInGraphDb ( anotherDatasetTitle , sharedDocUrl )
217
242
218
243
// delete the collection and verify dataset vertex is deleted
219
244
// the campaign/documentation/platformInstrument vertex that is not referenced by another collection is deleted
@@ -228,8 +253,8 @@ describe('indexCmrCollection handler', () => {
228
253
await verifyPlatformInstrumentsExistInGraphDb ( anotherDatasetTitle ,
229
254
{ platform : sharedPlatform , instruments : [ sharedInstrument ] } )
230
255
231
- await verifyDocumentationNotExistInGraphDb ( datasetTitle , ownDocName )
232
- await verifyDocumentationExistInGraphDb ( anotherDatasetTitle , sharedDocName )
256
+ await verifyDocumentationNotExistInGraphDb ( datasetTitle , ownDocUrl )
257
+ await verifyDocumentationExistInGraphDb ( anotherDatasetTitle , sharedDocUrl )
233
258
} )
234
259
235
260
test ( 'test update collection' , async ( ) => {
@@ -258,11 +283,11 @@ describe('indexCmrCollection handler', () => {
258
283
const newInstrument = 'NewInstrument'
259
284
260
285
// this documentation url is referenced by both the old and new version of the collection
261
- const keptDocName = 'https://en.wikipedia.org/wiki/latent_nfi'
286
+ const keptDocUrl = 'https://en.wikipedia.org/wiki/latent_nfi'
262
287
// this documentation url is referenced only by the old version of collection
263
- const removedDocName = 'https://en.wikipedia.org/wiki/latent_nfi_old'
288
+ const removedDocUrl = 'https://en.wikipedia.org/wiki/latent_nfi_old'
264
289
// this documentation url is referenced only by the new version of collection
265
- const newDocName = 'https://en.wikipedia.org/wiki/latent_nfi_new'
290
+ const newDocUrl = 'https://en.wikipedia.org/wiki/latent_nfi_new'
266
291
267
292
// first index the collection and verify dataset and documentation vertices are created
268
293
await updateCollection (
@@ -273,7 +298,7 @@ describe('indexCmrCollection handler', () => {
273
298
platforms : [
274
299
{ platform : keptPlatform , instruments : [ keptInstrument , removedInstrument ] } ,
275
300
{ platform : removedPlatform } ] ,
276
- docNames : [ keptDocName , removedDocName ]
301
+ relatedUrls : [ keptDocUrl , removedDocUrl ]
277
302
}
278
303
)
279
304
@@ -284,8 +309,8 @@ describe('indexCmrCollection handler', () => {
284
309
{ platform : keptPlatform , instruments : [ keptInstrument , removedInstrument ] } )
285
310
await verifyPlatformInstrumentsExistInGraphDb ( datasetTitle , { platform : removedPlatform } )
286
311
287
- await verifyDocumentationExistInGraphDb ( datasetTitle , keptDocName )
288
- await verifyDocumentationExistInGraphDb ( datasetTitle , removedDocName )
312
+ await verifyDocumentationExistInGraphDb ( datasetTitle , keptDocUrl )
313
+ await verifyDocumentationExistInGraphDb ( datasetTitle , removedDocUrl )
289
314
290
315
// update the collection
291
316
await updateCollection (
@@ -296,7 +321,7 @@ describe('indexCmrCollection handler', () => {
296
321
platforms : [
297
322
{ platform : keptPlatform , instruments : [ keptInstrument , newInstrument ] } ,
298
323
{ platform : newPlatform , instruments : [ newInstrument ] } ] ,
299
- docNames : [ keptDocName , newDocName ]
324
+ relatedUrls : [ keptDocUrl , newDocUrl ]
300
325
}
301
326
)
302
327
@@ -305,7 +330,7 @@ describe('indexCmrCollection handler', () => {
305
330
await verifyPlatformInstrumentsNotExistInGraphDb ( datasetTitle ,
306
331
{ platform : keptPlatform , instruments : [ removedInstrument ] } )
307
332
await verifyPlatformInstrumentsNotExistInGraphDb ( datasetTitle , { platform : removedPlatform } )
308
- await verifyDocumentationNotExistInGraphDb ( datasetTitle , removedDocName )
333
+ await verifyDocumentationNotExistInGraphDb ( datasetTitle , removedDocUrl )
309
334
310
335
// verify the dataset vertext with the new title exist,
311
336
// verify the campaign/documentation vertices referenced by another collection exist,
@@ -316,7 +341,7 @@ describe('indexCmrCollection handler', () => {
316
341
{ platform : keptPlatform , instruments : [ keptInstrument , newInstrument ] } )
317
342
await verifyPlatformInstrumentsExistInGraphDb ( anotherDatasetTitle ,
318
343
{ platform : newPlatform , instruments : [ newInstrument ] } )
319
- await verifyDocumentationExistInGraphDb ( anotherDatasetTitle , keptDocName )
320
- await verifyDocumentationExistInGraphDb ( anotherDatasetTitle , newDocName )
344
+ await verifyDocumentationExistInGraphDb ( anotherDatasetTitle , keptDocUrl )
345
+ await verifyDocumentationExistInGraphDb ( anotherDatasetTitle , newDocUrl )
321
346
} )
322
347
} )
0 commit comments