From 27a378b8e96907b293ad1cb4ed7ff37f1aec70b9 Mon Sep 17 00:00:00 2001 From: vitorgrenzel Date: Wed, 3 Mar 2021 19:42:23 -0300 Subject: [PATCH] Update test fetchTechDocsMetadata Signed-off-by: vitorgrenzel --- .../src/stages/publish/azureBlobStorage.ts | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/packages/techdocs-common/src/stages/publish/azureBlobStorage.ts b/packages/techdocs-common/src/stages/publish/azureBlobStorage.ts index a0f512df6e..155d14fbb5 100644 --- a/packages/techdocs-common/src/stages/publish/azureBlobStorage.ts +++ b/packages/techdocs-common/src/stages/publish/azureBlobStorage.ts @@ -217,26 +217,19 @@ export class AzureBlobStoragePublish implements PublisherBase { ): Promise { const entityRootDir = `${entityName.namespace}/${entityName.kind}/${entityName.name}`; try { - return await new Promise(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}`); }