From 209af50a4c8b02c1d80808d306b4d334748de941 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 9 Apr 2025 15:55:29 +0000 Subject: [PATCH] fix(test): Await file writes in Handelsregister tests to ensure all downloads complete before test end --- changelog.md | 6 ++++++ test/test.handelsregister.ts | 4 ++-- ts/00_commitinfo_data.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 7b99d61..85c91e0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-04-09 - 1.5.3 - fix(test) +Await file writes in Handelsregister tests to ensure all downloads complete before test end + +- Replaced array.map with await Promise.all to properly await asynchronous file writes in test/test.handelsregister.ts +- Improved robustness of asynchronous operations in test suite + ## 2025-04-09 - 1.5.2 - fix(readme) Improve .env configuration code block formatting in documentation diff --git a/test/test.handelsregister.ts b/test/test.handelsregister.ts index 2b824f6..310d0be 100644 --- a/test/test.handelsregister.ts +++ b/test/test.handelsregister.ts @@ -27,9 +27,9 @@ tap.test('should get the data for a specific company', async () => { const result = await testOpenDataInstance.handelsregister.getSpecificCompany(testCompany); console.log(result); - result.files.map(async (file) => { + await Promise.all(result.files.map(async (file) => { await file.writeToDir('./.nogit/testoutput'); - }); + })); }); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 0924354..a9c6d11 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@fin.cx/opendata', - version: '1.5.2', + version: '1.5.3', description: 'A comprehensive TypeScript library that manages open business data for German companies by integrating MongoDB, processing JSONL bulk data, and automating browser interactions for Handelsregister data retrieval.' }