Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('has expected payload', () => {
expect(granule.published).toBe(true);
expect(granule.cmrLink).toEqual(`${getUrl('search')}granules.json?concept_id=${granule.cmrConceptId}`);
// Set the expected CMR values since they're going to be different
// every time this is run.
const updatedExpectedPayload = cloneDeep(expectedPayload);
updatedExpectedPayload.granules[0].cmrLink = granule.cmrLink;
updatedExpectedPayload.granules[0].cmrConceptId = granule.cmrConceptId;
expect(postToCmrOutput.payload).toEqual(updatedExpectedPayload);
});
it('has expected payload', () => {
expect(granule.published).toBe(true);
expect(granule.cmrLink).toEqual(`${getUrl('search')}granules.json?concept_id=${granule.cmrConceptId}`);
// Set the expected CMR values since they're going to be different
// every time this is run.
const updatedExpectedPayload = cloneDeep(expectedPayload);
updatedExpectedPayload.granules[0].cmrLink = granule.cmrLink;
updatedExpectedPayload.granules[0].cmrConceptId = granule.cmrConceptId;
expect(postToCmrOutput.payload).toEqual(updatedExpectedPayload);
});
it('has expected payload', () => {
expect(granule.cmrLink).toEqual(`${getUrl('search', null, 'UAT')}granules.json?concept_id=${granule.cmrConceptId}`);
const updatedGranule = expectedPayload.granules[0];
const thisExpectedPayload = {
...expectedPayload,
granules: [
{
...updatedGranule,
cmrConceptId: postToCmrOutput.payload.granules[0].cmrConceptId,
cmrLink: postToCmrOutput.payload.granules[0].cmrLink,
post_to_cmr_duration: postToCmrOutput.payload.granules[0].post_to_cmr_duration,
sync_granule_duration: postToCmrOutput.payload.granules[0].sync_granule_duration
}
]
};
expect(postToCmrOutput.payload).toEqual(thisExpectedPayload);
});
creds.clientId,
creds.username,
password
);
const xml = cmrFile.metadata;
const res = await cmr.ingestGranule(xml);
const conceptId = res.result['concept-id'];
log.info(`Published ${cmrFile.granuleId} to the CMR. conceptId: ${conceptId}`);
return {
granuleId: cmrFile.granuleId,
filename: cmrFile.filename,
conceptId,
link: `${getUrl('search')}granules.json?concept_id=${res.result['concept-id']}`
};
}