@cumulus/integration-tests 20.1.0 → 20.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cmr.js CHANGED
@@ -223,12 +223,10 @@ function generateCmrXml(granule, collection, additionalUrls) {
223
223
  * @returns {Promise<Array<string>>} - Promise of a list of granule files including the created
224
224
  * CMR xml files
225
225
  */
226
- async function generateAndStoreCmrXml(granule, collection, bucket, additionalUrls) {
226
+ async function generateAndStoreCmrXml(granule, collection, bucket, additionalUrls, stagingDir = 'file-staging') {
227
227
  const xml = generateCmrXml(granule, collection, additionalUrls);
228
228
  const granuleFiles = granule.files.map((f) => `s3://${f.bucket}/${f.key}`);
229
229
 
230
- const stagingDir = 'file-staging';
231
-
232
230
  const fileKey = `${stagingDir}/${granule.granuleId}.cmr.xml`;
233
231
 
234
232
  const params = {
@@ -357,7 +355,8 @@ async function generateAndStoreCmrUmmJson(
357
355
  collection,
358
356
  bucket,
359
357
  additionalUrls,
360
- cmrMetadataFormat
358
+ cmrMetadataFormat,
359
+ stagingDir = 'file-staging'
361
360
  ) {
362
361
  const versionString = metadataFormatToVersion(cmrMetadataFormat);
363
362
  const jsonObject = sampleUmmGranule;
@@ -385,8 +384,6 @@ async function generateAndStoreCmrUmmJson(
385
384
  };
386
385
  }
387
386
 
388
- const stagingDir = 'file-staging';
389
-
390
387
  const fileKey = `${stagingDir}/${granule.granuleId}.cmr.json`;
391
388
 
392
389
  const params = {
@@ -419,26 +416,40 @@ async function generateAndStoreCmrUmmJson(
419
416
  * @param {Array<string>} additionalUrls - URLs to convert to online resources or related urls
420
417
  * @returns {Array<string>} list of S3 locations for CMR xml files
421
418
  */
422
- async function generateCmrFilesForGranules(
419
+ async function generateCmrFilesForGranules({
423
420
  granules,
424
421
  collection,
425
422
  bucket,
426
423
  cmrMetadataFormat,
427
- additionalUrls
428
- ) {
424
+ additionalUrls,
425
+ stagingDir,
426
+ }) {
429
427
  let files;
430
428
 
431
429
  log.info(`Generating fake CMR file with type ${cmrMetadataFormat}`);
432
430
 
433
431
  if (isUMMGMetadataFormat(cmrMetadataFormat)) {
434
432
  files = await Promise.all(
435
- granules.map(
436
- (g) => generateAndStoreCmrUmmJson(g, collection, bucket, additionalUrls, cmrMetadataFormat)
437
- )
433
+ granules.map((g) =>
434
+ generateAndStoreCmrUmmJson(
435
+ g,
436
+ collection,
437
+ bucket,
438
+ additionalUrls,
439
+ cmrMetadataFormat,
440
+ stagingDir
441
+ ))
438
442
  );
439
443
  } else {
440
444
  files = await Promise.all(
441
- granules.map((g) => generateAndStoreCmrXml(g, collection, bucket, additionalUrls))
445
+ granules.map((g) =>
446
+ generateAndStoreCmrXml(
447
+ g,
448
+ collection,
449
+ bucket,
450
+ additionalUrls,
451
+ stagingDir
452
+ ))
442
453
  );
443
454
  }
444
455