Skip to content

Commit

Permalink
Merge pull request #69 from dogdb-org/hero-component-test
Browse files Browse the repository at this point in the history
Merge pull request #40 Hero component tests
  • Loading branch information
Abhishek7Tech authored May 13, 2024
2 parents 3a11203 + ba05cb3 commit 99ff282
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions components/Hero/__test__/Hero.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import '@testing-library/jest-dom'
import { render } from '@testing-library/react'
import Hero from '../index'

const { expect, describe, it } = require('@jest/globals')

describe('Hero Component', () => {
it('renders the hero image correctly', () => {
const { getByAltText, getByText, getAllByText } = render(<Hero />)
expect(
getByAltText('an image of dog running with joy')
).toBeInTheDocument()
expect(
getByText('Discover the ideal companion for your lifestyle')
).toBeInTheDocument()
// Find your perfect dog breed heading is wriiten 2 times. 1 for mobile screen the other one for desktop screen
const breedHeading = getAllByText('Find your perfect dog breed')
expect(breedHeading.length).toBe(2)
})
})

0 comments on commit 99ff282

Please sign in to comment.