()
| 18 | let browser |
| 19 | |
| 20 | function runTests() { |
| 21 | it('should load static unicode image', async () => { |
| 22 | const src = await browser.elementById('static').getAttribute('src') |
| 23 | expect(src).toMatch( |
| 24 | /_next%2Fstatic%2Fmedia%2F%C3%A4%C3%B6%C3%BC%C5%A1%C4%8D%C5%99%C3%AD(.+)png/ |
| 25 | ) |
| 26 | const fullSrc = new URL(src, `http://localhost:${appPort}`) |
| 27 | const res = await fetch(fullSrc) |
| 28 | expect(res.status).toBe(200) |
| 29 | }) |
| 30 | |
| 31 | it('should load internal unicode image', async () => { |
| 32 | const src = await browser.elementById('internal').getAttribute('src') |
| 33 | expect(src).toMatch( |
| 34 | '/_next/image?url=%2F%C3%A4%C3%B6%C3%BC%C5%A1%C4%8D%C5%99%C3%AD.png' |
| 35 | ) |
| 36 | const fullSrc = new URL(src, `http://localhost:${appPort}`) |
| 37 | const res = await fetch(fullSrc) |
| 38 | expect(res.status).toBe(200) |
| 39 | }) |
| 40 | |
| 41 | it('should load external unicode image', async () => { |
| 42 | const src = await browser.elementById('external').getAttribute('src') |
| 43 | expect(src).toMatch( |
| 44 | '/_next/image?url=https%3A%2F%2Fimage-optimization-test.vercel.app%2F%C3%A4%C3%B6%C3%BC%C5%A1%C4%8D%C5%99%C3%AD.png' |
| 45 | ) |
| 46 | const fullSrc = new URL(src, `http://localhost:${appPort}`) |
| 47 | const res = await fetch(fullSrc) |
| 48 | expect(res.status).toBe(200) |
| 49 | }) |
| 50 | |
| 51 | it('should load internal image with space', async () => { |
| 52 | const src = await browser.elementById('internal-space').getAttribute('src') |
| 53 | expect(src).toMatch('/_next/image?url=%2Fhello%2520world.jpg') |
| 54 | const fullSrc = new URL(src, `http://localhost:${appPort}`) |
| 55 | const res = await fetch(fullSrc) |
| 56 | expect(res.status).toBe(200) |
| 57 | }) |
| 58 | |
| 59 | it('should load external image with space', async () => { |
| 60 | const src = await browser.elementById('external-space').getAttribute('src') |
| 61 | expect(src).toMatch( |
| 62 | '/_next/image?url=https%3A%2F%2Fimage-optimization-test.vercel.app%2Fhello%2520world.jpg' |
| 63 | ) |
| 64 | const fullSrc = new URL(src, `http://localhost:${appPort}`) |
| 65 | const res = await fetch(fullSrc) |
| 66 | expect(res.status).toBe(200) |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | describe('Image Component Unicode Image URL', () => { |
| 71 | ;(process.env.TURBOPACK_BUILD ? describe.skip : describe)( |
no test coverage detected