Update test fetchTechDocsMetadata

Signed-off-by: vitorgrenzel <vitorgrenzel@gmail.com>
This commit is contained in:
vitorgrenzel
2021-03-03 19:42:23 -03:00
parent 52396fbe9d
commit 27a378b8e9
@@ -217,26 +217,19 @@ export class AzureBlobStoragePublish implements PublisherBase {
): Promise<TechDocsMetadata> {
const entityRootDir = `${entityName.namespace}/${entityName.kind}/${entityName.name}`;
try {
return await new Promise<TechDocsMetadata>(async (resolve, reject) => {
try {
const techdocsMetadataJson = await this.download(
this.containerName,
`${entityRootDir}/techdocs_metadata.json`,
);
if (!techdocsMetadataJson) {
throw new Error(
`Unable to parse the techdocs metadata file ${entityRootDir}/techdocs_metadata.json.`,
);
}
const techdocsMetadata = JSON5.parse(
techdocsMetadataJson.toString('utf-8'),
);
resolve(techdocsMetadata);
} catch (err) {
this.logger.error(err.message);
reject(new Error(err.message));
}
});
const techdocsMetadataJson = await this.download(
this.containerName,
`${entityRootDir}/techdocs_metadata.json`,
);
if (!techdocsMetadataJson) {
throw new Error(
`Unable to parse the techdocs metadata file ${entityRootDir}/techdocs_metadata.json.`,
);
}
const techdocsMetadata = JSON5.parse(
techdocsMetadataJson.toString('utf-8'),
);
return techdocsMetadata;
} catch (e) {
throw new Error(`TechDocs metadata fetch failed, ${e.message}`);
}