Skip to content

Commit

Permalink
uncommenting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonlunn committed Sep 19, 2023
1 parent 7538446 commit 7e1bd67
Showing 1 changed file with 19 additions and 28 deletions.
47 changes: 19 additions & 28 deletions src/components/media/__tests__/PhotoMontage.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
// import '@testing-library/jest-dom/extend-expect'
// import { render, screen } from '@testing-library/react'
// import PhotoMontage from '../PhotoMontage'
// import { mediaList } from './data'
import '@testing-library/jest-dom/extend-expect'
import { render, screen } from '@testing-library/react'
import PhotoMontage from '../PhotoMontage'
import { mediaList } from './data'

// test('PhotoMontage can render 1 photo', async () => {
// render(<PhotoMontage photoList={mediaList.slice(0, 1)} isHero />)
// const elements: HTMLImageElement[] = await screen.findAllByRole('img')
// expect(elements.length).toBe(1)
// expect(elements[0].src).toContain(mediaList[0].mediaUrl)
// })

// test('PhotoMontage always renders 2 photos when provided with a list of 2 to 4', async () => {
// render(<PhotoMontage photoList={mediaList.slice(0, 3)} isHero />)
// const elements: HTMLImageElement[] = await screen.findAllByRole('img')
// expect(elements.length).toBe(2) // should be 2
// })

// test('PhotoMontage always renders 5 photos when provided with a list > 5', async () => {
// render(<PhotoMontage photoList={mediaList} isHero />)
// const elements: HTMLImageElement[] = await screen.findAllByRole('img')
// expect(elements.length).toBe(5) // should be 5
// })
test('PhotoMontage can render 1 photo', async () => {
render(<PhotoMontage photoList={mediaList.slice(0, 1)} isHero />)
const elements: HTMLImageElement[] = await screen.findAllByRole('img')
expect(elements.length).toBe(1)
expect(elements[0].src).toContain(mediaList[0].mediaUrl)
})

describe('basic true test', () => {
test('true is true', () => {
expect(true).toBe(true)
})
test('PhotoMontage always renders 2 photos when provided with a list of 2 to 4', async () => {
render(<PhotoMontage photoList={mediaList.slice(0, 3)} isHero />)
const elements: HTMLImageElement[] = await screen.findAllByRole('img')
expect(elements.length).toBe(2) // should be 2
})

// commenting out to get the commit to pass
// will need to fix this later
test('PhotoMontage always renders 5 photos when provided with a list > 5', async () => {
render(<PhotoMontage photoList={mediaList} isHero />)
const elements: HTMLImageElement[] = await screen.findAllByRole('img')
expect(elements.length).toBe(5) // should be 5
})

0 comments on commit 7e1bd67

Please sign in to comment.