Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jthcast committed Jun 16, 2021
1 parent 56fa669 commit 3446c9b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import Image from 'next/image'

export default function Page() {
return (
<div>
<p>Invalid weight or height</p>

<Image
src="/test.jpg"
width="fill"
height="fill"
layout="responsive"
placeholder="blur"
blurDataURL="/test.jpg"
/>
</div>
)
}
9 changes: 9 additions & 0 deletions test/integration/image-component/default/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,15 @@ function runTests(mode) {
)
})

it('should show error when not numeric string width or height', async () => {
const browser = await webdriver(appPort, '/invalid-weight-or-height')

expect(await hasRedbox(browser)).toBe(true)
expect(await getRedboxHeader(browser)).toContain(
`Image with src "/test.jpg" has invalid "width" or "height" property. These should be numeric values.`
)
})

it('should show error when static import and placeholder=blur and blurDataUrl is missing', async () => {
const browser = await webdriver(
appPort,
Expand Down

0 comments on commit 3446c9b

Please sign in to comment.