From 229b99ae49ddf26a9c0683da190c3397780ccf6a Mon Sep 17 00:00:00 2001 From: Jens Pots Date: Fri, 21 Jun 2024 13:24:39 +0200 Subject: [PATCH] test: test swedish dataset --- src/index.ts | 8 ++++++-- tests/online/index.test.ts | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2fe9301..802fb0f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -169,8 +169,12 @@ export async function httpFetch( } // Push the data down the pipeline. - const body = await res.text(); - await writer.push(body); + try { + const body = await res.text(); + await writer.push(body); + } catch (e) { + console.error(e); + } }; // Executes each individual request and groups them into a single promise. diff --git a/tests/online/index.test.ts b/tests/online/index.test.ts index 795a91d..0dc98f7 100644 --- a/tests/online/index.test.ts +++ b/tests/online/index.test.ts @@ -156,4 +156,23 @@ describe("Real world datasets", () => { return expect(func()).resolves.toBeUndefined(); }); + + test( + "Swedish - success", + async () => { + const writeStream = writer((output) => { + console.log( + `Size of incoming data: ${output.length} characters.`, + ); + }); + + const func = await httpFetch( + "https://admin.dataportal.se/all.rdf", + writeStream, + ); + + return expect(func()).resolves.toBeUndefined(); + }, + 60 * 1000, + ); });