Skip to content

Commit

Permalink
fix: adding more unit test to video component
Browse files Browse the repository at this point in the history
  • Loading branch information
nhussein11 committed Aug 6, 2023
1 parent 57f957b commit a99d285
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/lib/components/video/video.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,62 @@ describe('IPFSVideo', () => {
const loading = screen.getByText('Loading...')
expect(loading).toBeDefined()
})
it('should render the IPFSVideo component with a gateway and a thumbnail and a loading component and muted', () => {
render(
<VideoIPFS
hash="Qmc2oeTErghqoTB3N9j8te8QEfGRPTfTNH77aXARiMeuDJ"
gateway="https://ipfs.io/ipfs/"
thumbnail="https://ipfs.io/ipfs/QmZ9y1Vd7X9s8XG4Zz1Xh7k2Lj6Z5oQ6c5sJgU7h6LQ3bC"
loadingComponent={<div>Loading...</div>}
muted
/>,
)
const video = document.querySelector('video')
expect(video).toBeDefined()
const loading = screen.getByText('Loading...')
expect(loading).toBeDefined()
const muted = video?.getAttribute('muted')
expect(muted).toBeDefined()
})
it('should render the IPFSVideo component with a gateway and a thumbnail and a loading component and muted and autoplay', () => {
render(
<VideoIPFS
hash="Qmc2oeTErghqoTB3N9j8te8QEfGRPTfTNH77aXARiMeuDJ"
gateway="https://ipfs.io/ipfs/"
thumbnail="https://ipfs.io/ipfs/QmZ9y1Vd7X9s8XG4Zz1Xh7k2Lj6Z5oQ6c5sJgU7h6LQ3bC"
loadingComponent={<div>Loading...</div>}
muted
/>,
)
const video = document.querySelector('video')
expect(video).toBeDefined()
const loading = screen.getByText('Loading...')
expect(loading).toBeDefined()
const muted = video?.getAttribute('muted')
expect(muted).toBeDefined()
const autoplay = video?.getAttribute('autoplay')
expect(autoplay).toBeDefined()
})
it('should render the IPFSVideo component with a gateway and a thumbnail and a loading component and muted and autoplay and loop', () => {
render(
<VideoIPFS
hash="Qmc2oeTErghqoTB3N9j8te8QEfGRPTfTNH77aXARiMeuDJ"
gateway="https://ipfs.io/ipfs/"
thumbnail="https://ipfs.io/ipfs/QmZ9y1Vd7X9s8XG4Zz1Xh7k2Lj6Z5oQ6c5sJgU7h6LQ3bC"
loadingComponent={<div>Loading...</div>}
muted
loop
/>,
)
const video = document.querySelector('video')
expect(video).toBeDefined()
const loading = screen.getByText('Loading...')
expect(loading).toBeDefined()
const muted = video?.getAttribute('muted')
expect(muted).toBeDefined()
const autoplay = video?.getAttribute('autoplay')
expect(autoplay).toBeDefined()
const loop = video?.getAttribute('loop')
expect(loop).toBeDefined()
})
})

0 comments on commit a99d285

Please sign in to comment.