Skip to content

Commit

Permalink
test: Update 'validates url is valid' test (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
trillium authored Nov 19, 2024
1 parent ff4b6f1 commit e69b3d5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/__tests__/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ test('validates links are unique', () => {

test('validates url is valid', () => {
expect(() => validateUrl('https://blah.com')).not.toThrow()
expect(() => validateUrl('blah')).toThrowErrorMatchingInlineSnapshot(
`"Invalid URL: blah"`,
)
expect(() => validateUrl('blah')).toThrow()
const urlError1 = 'Invalid URL'
const urlError2 = 'Invalid URL: blah'
const errorMessages = new RegExp(`${urlError1}|${urlError2}`)
expect(() => validateUrl('blah')).toThrow(errorMessages)
})

test('adds https:// to url if protocol is missing', () => {
Expand Down

0 comments on commit e69b3d5

Please sign in to comment.