Skip to content

Commit

Permalink
fix: volume video unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
nhussein11 committed Aug 6, 2023
1 parent 7656327 commit 1f53ded
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/lib/components/video/video.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,46 @@ describe('IPFSVideo', () => {
const loop = video?.getAttribute('loop')
expect(loop).toBeDefined()
})
it('should render the IPFSVideo component with a gateway and a thumbnail and a loading component and muted and autoplay and loop and controls', () => {
render(
<VideoIPFS
hash="Qmc2oeTErghqoTB3N9j8te8QEfGRPTfTNH77aXARiMeuDJ"
gateway="https://ipfs.io/ipfs/"
thumbnail="https://ipfs.io/ipfs/QmZ9y1Vd7X9s8XG4Zz1Xh7k2Lj6Z5oQ6c5sJgU7h6LQ3bC"
loadingComponent={<div>Loading...</div>}
muted
loop
controls
/>,
)
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()
const controls = video?.getAttribute('controls')
expect(controls).toBeDefined()
})
it('should render the IPFSVideo component with specific volume', () => {
render(
<VideoIPFS
hash="Qmc2oeTErghqoTB3N9j8te8QEfGRPTfTNH77aXARiMeuDJ"
gateway="https://ipfs.io/ipfs/"
thumbnail="https://ipfs.io/ipfs/QmZ9y1Vd7X9s8XG4Zz1Xh7k2Lj6Z5oQ6c5sJgU7h6LQ3bC"
loadingComponent={<div>Loading...</div>}
muted
loop
controls
volume={0.5}
/>,
)
const video = document.querySelector('video')
expect(video).toBeDefined()
expect(video.volume).toBe(0.5)
})
})

0 comments on commit 1f53ded

Please sign in to comment.