Skip to content

Commit

Permalink
Add another test for percent
Browse files Browse the repository at this point in the history
  • Loading branch information
styfle committed Aug 12, 2021
1 parent 00e5274 commit 2a5052f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/integration/image-component/unicode/pages/index.js
Expand Up @@ -14,6 +14,13 @@ const Page = () => {
width={400}
height={400}
/>
<Image id="internal-precent" src="/50%.jpg" width={200} height={200} />
<Image
id="external-precent"
src="https://image-optimization-test.vercel.app/50%.jpg"
width={200}
height={200}
/>
</div>
)
}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions test/integration/image-component/unicode/test/index.test.js
Expand Up @@ -44,6 +44,26 @@ function runTests() {
const res = await fetch(src)
expect(res.status).toBe(200)
})

it('should load internal percent image', async () => {
const src = await browser
.elementById('internal-precent')
.getAttribute('src')
expect(src).toMatch('/_next/image?url=%2F50%25.jpg')
const res = await fetch(src)
expect(res.status).toBe(200)
})

it('should load external percent image', async () => {
const src = await browser
.elementById('external-precent')
.getAttribute('src')
expect(src).toMatch(
'/_next/image?url=https%3A%2F%2Fimage-optimization-test.vercel.app%2F50%25.jpg'
)
const res = await fetch(src)
expect(res.status).toBe(200)
})
}

describe('Image Component Unicode Image URL', () => {
Expand Down

0 comments on commit 2a5052f

Please sign in to comment.