Fix blob randomness

This commit is contained in:
Maximilian Harz 2025-06-10 13:34:31 +02:00
parent 301e02f067
commit 2af709f0a2
2 changed files with 8 additions and 3 deletions

View File

@ -105,6 +105,11 @@ describe('GalleryForm', () => {
new File([image], `test-image-${index + 1}.jpg`, { type: 'image/jpeg' }),
),
})
wrapper.container.querySelectorAll('img').forEach((img) => {
expect(img.src).toMatch(/blob:/) // Ensure the image is a blob URL
// Replace random blob URL for consistent snapshots
img.src = 'blob-url-placeholder'
})
expect(wrapper.container).toMatchSnapshot()
})
})

View File

@ -113,7 +113,7 @@ exports[`GalleryForm > with uploading images > renders 1`] = `
<img
alt="Gallery image 1"
class="tw:w-full tw:h-full tw:object-cover tw:rounded-lg tw:opacity-50"
src="blob:nodedata:0367ec51-1221-473c-8913-4c6ad0aa1e60"
src="blob-url-placeholder"
/>
<span
class="tw:loading tw:loading-spinner tw:absolute tw:inset-0 tw:m-auto"
@ -125,7 +125,7 @@ exports[`GalleryForm > with uploading images > renders 1`] = `
<img
alt="Gallery image 2"
class="tw:w-full tw:h-full tw:object-cover tw:rounded-lg tw:opacity-50"
src="blob:nodedata:a37cf0d3-d78f-48ec-b7b6-8b7f865e1b97"
src="blob-url-placeholder"
/>
<span
class="tw:loading tw:loading-spinner tw:absolute tw:inset-0 tw:m-auto"
@ -137,7 +137,7 @@ exports[`GalleryForm > with uploading images > renders 1`] = `
<img
alt="Gallery image 3"
class="tw:w-full tw:h-full tw:object-cover tw:rounded-lg tw:opacity-50"
src="blob:nodedata:17392be8-95f6-4194-b425-19f2aa18d325"
src="blob-url-placeholder"
/>
<span
class="tw:loading tw:loading-spinner tw:absolute tw:inset-0 tw:m-auto"