From 3ed31adb5272a18fce55a7fb1a26dc14649d5eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20W=C5=82odek?= Date: Mon, 20 Jan 2025 13:43:45 +0100 Subject: [PATCH] fix(common): add fallback for missing env var and stub in tests --- packages/common/src/ui/hooks/__tests__/useFetchImage.test.tsx | 1 + packages/common/src/ui/hooks/useFetchImage.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/common/src/ui/hooks/__tests__/useFetchImage.test.tsx b/packages/common/src/ui/hooks/__tests__/useFetchImage.test.tsx index f2bd8d6f5b..7769ee02f7 100644 --- a/packages/common/src/ui/hooks/__tests__/useFetchImage.test.tsx +++ b/packages/common/src/ui/hooks/__tests__/useFetchImage.test.tsx @@ -20,6 +20,7 @@ describe('useFetchImage', () => { return mockImage; } } as typeof Image; + process.env.BLOCKFROST_IPFS_URL = 'https://ipfs.blockfrost.dev'; }); afterEach(() => { diff --git a/packages/common/src/ui/hooks/useFetchImage.ts b/packages/common/src/ui/hooks/useFetchImage.ts index 3a3b3a90ef..359ea27ee3 100644 --- a/packages/common/src/ui/hooks/useFetchImage.ts +++ b/packages/common/src/ui/hooks/useFetchImage.ts @@ -10,7 +10,7 @@ type ImageFetchStateMap = { export type UseFetchImageState = ImageFetchStateMap[ImageFetchStatus]; -const BLOCKFROST_IPFS_URL = process.env.BLOCKFROST_IPFS_URL || ''; +const BLOCKFROST_IPFS_URL = process.env.BLOCKFROST_IPFS_URL || ' '; const maxConcurrentBlockfrostRequests = Number.parseInt(process.env.BLOCKFROST_IPFS_CONCURRENT_REQUESTS || '0', 10); let concurrentBlockfrostRequestsCount = 0;