From faa01cec736ca897d75e549dded3debbaa49d1ed Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Wed, 9 Nov 2022 10:22:53 -0500 Subject: [PATCH] Fix the image tests (#5338) * Fix the image tests * fix more base tests --- .../image/test/fixtures/basic-image/src/pages/index.astro | 3 ++- .../image/test/fixtures/basic-picture/src/pages/index.astro | 3 ++- packages/integrations/image/test/image-ssg.test.js | 2 +- packages/integrations/image/test/image-ssr-build.test.js | 2 +- packages/integrations/image/test/image-ssr-dev.test.js | 2 +- packages/integrations/image/test/picture-ssg.test.js | 2 +- packages/integrations/image/test/picture-ssr-build.test.js | 2 +- packages/integrations/image/test/picture-ssr-dev.test.js | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/integrations/image/test/fixtures/basic-image/src/pages/index.astro b/packages/integrations/image/test/fixtures/basic-image/src/pages/index.astro index 0d7fa47c2..cac182c39 100644 --- a/packages/integrations/image/test/fixtures/basic-image/src/pages/index.astro +++ b/packages/integrations/image/test/fixtures/basic-image/src/pages/index.astro @@ -2,6 +2,7 @@ import socialJpg from '../assets/social.jpg'; import introJpg from '../assets/blog/introducing astro.jpg'; import { Image } from '@astrojs/image/components'; +const publicImage = new URL('./hero.jpg', Astro.url); --- @@ -9,7 +10,7 @@ import { Image } from '@astrojs/image/components'; - hero + hero
spaces
diff --git a/packages/integrations/image/test/fixtures/basic-picture/src/pages/index.astro b/packages/integrations/image/test/fixtures/basic-picture/src/pages/index.astro index e05f878d4..086cea388 100644 --- a/packages/integrations/image/test/fixtures/basic-picture/src/pages/index.astro +++ b/packages/integrations/image/test/fixtures/basic-picture/src/pages/index.astro @@ -2,6 +2,7 @@ import socialJpg from '../assets/social.jpg'; import introJpg from '../assets/blog/introducing astro.jpg'; import { Picture } from '@astrojs/image/components'; +const publicImage = new URL('./hero.jpg', Astro.url); --- @@ -9,7 +10,7 @@ import { Picture } from '@astrojs/image/components'; - +

diff --git a/packages/integrations/image/test/image-ssg.test.js b/packages/integrations/image/test/image-ssg.test.js index 893fd4da8..2b724c1e3 100644 --- a/packages/integrations/image/test/image-ssg.test.js +++ b/packages/integrations/image/test/image-ssg.test.js @@ -164,7 +164,7 @@ describe('SSG images with subpath - dev', function () { title: 'Public images', id: '#hero', url: '/_image', - query: { f: 'webp', w: '768', h: '414', href: '/hero.jpg' }, + query: { f: 'webp', w: '768', h: '414', href: '/docs/hero.jpg' }, }, { title: 'Background color', diff --git a/packages/integrations/image/test/image-ssr-build.test.js b/packages/integrations/image/test/image-ssr-build.test.js index c20692c0e..65c1b3083 100644 --- a/packages/integrations/image/test/image-ssr-build.test.js +++ b/packages/integrations/image/test/image-ssr-build.test.js @@ -186,7 +186,7 @@ describe('SSR images with subpath - build', function () { title: 'Public images', id: '#hero', url: '/_image', - query: { f: 'webp', w: '768', h: '414', href: '/hero.jpg' }, + query: { f: 'webp', w: '768', h: '414', href: '/docs/hero.jpg' }, }, { title: 'Background color', diff --git a/packages/integrations/image/test/image-ssr-dev.test.js b/packages/integrations/image/test/image-ssr-dev.test.js index 9b48dbeab..6dcc9bfd2 100644 --- a/packages/integrations/image/test/image-ssr-dev.test.js +++ b/packages/integrations/image/test/image-ssr-dev.test.js @@ -199,7 +199,7 @@ describe('SSR images with subpath - dev', function () { f: 'webp', w: '768', h: '414', - href: '/hero.jpg', + href: '/docs/hero.jpg', }, contentType: 'image/webp', }, diff --git a/packages/integrations/image/test/picture-ssg.test.js b/packages/integrations/image/test/picture-ssg.test.js index c14046220..b92e6f366 100644 --- a/packages/integrations/image/test/picture-ssg.test.js +++ b/packages/integrations/image/test/picture-ssg.test.js @@ -154,7 +154,7 @@ describe('SSG pictures with subpath - dev', function () { title: 'Public images', id: '#hero', url: '/_image', - query: { f: 'jpg', w: '768', h: '414', href: '/hero.jpg' }, + query: { f: 'jpg', w: '768', h: '414', href: '/docs/hero.jpg' }, alt: 'Hero image', }, ].forEach(({ title, id, url, query, alt }) => { diff --git a/packages/integrations/image/test/picture-ssr-build.test.js b/packages/integrations/image/test/picture-ssr-build.test.js index 57429fde8..c5852f822 100644 --- a/packages/integrations/image/test/picture-ssr-build.test.js +++ b/packages/integrations/image/test/picture-ssr-build.test.js @@ -175,7 +175,7 @@ describe('SSR pictures with subpath - build', function () { title: 'Public images', id: '#hero', url: '/_image', - query: { f: 'jpg', w: '768', h: '414', href: '/hero.jpg' }, + query: { f: 'jpg', w: '768', h: '414', href: '/docs/hero.jpg' }, alt: 'Hero image', }, { diff --git a/packages/integrations/image/test/picture-ssr-dev.test.js b/packages/integrations/image/test/picture-ssr-dev.test.js index b21ee202a..7ddae9424 100644 --- a/packages/integrations/image/test/picture-ssr-dev.test.js +++ b/packages/integrations/image/test/picture-ssr-dev.test.js @@ -213,7 +213,7 @@ describe('SSR pictures with subpath - dev', function () { f: 'jpg', w: '768', h: '414', - href: '/hero.jpg', + href: '/docs/hero.jpg', }, contentType: 'image/jpeg', alt: 'Hero image',