From 18d9a9fc1fc1f3b2bcd6f7948efe2bf70605fec2 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 17 May 2022 22:17:22 -0400 Subject: [PATCH] Add test for relative paths --- packages/astro-imagetools/api/utils/getSrcPath.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/astro-imagetools/api/utils/getSrcPath.test.ts b/packages/astro-imagetools/api/utils/getSrcPath.test.ts index aad0b8ad..8e6f84fb 100644 --- a/packages/astro-imagetools/api/utils/getSrcPath.test.ts +++ b/packages/astro-imagetools/api/utils/getSrcPath.test.ts @@ -53,4 +53,11 @@ describe('getLinkElement', () => { const result = getSrcPath('https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG'); expect(result).toBe('https://cdn.nedis.com/images/products_high_res/TVRC2080BK_P30.JPG'); }) + + it('finds relative paths correctly', () => { + const outResult = getSrcPath('./out/out.jpeg'); + const rootResult = getSrcPath('./root.jpeg'); + expect(outResult).toBe(buildPath('out/out.jpeg')); + expect(rootResult).toBe(buildPath('root.jpeg')); + }) })