import { renderHook } from "@testing-library/react-hooks" ; import usePlayer from "./usePlayer" ; import { Args } from "./usePlayer.types" ; describe ( "usePlayer" , ( ) => { test ( "should render correctly" , ( ) => { const args = { src : "https://storage.googleapis.com/media-session/elephants-dream/the-wires.mp3" , preload : "auto" , autoplay : false , volume : 1.0 , rate : 1.0 , mute : false , loop : false , } ; const { result } = renderHook ( ( ) => usePlayer ( args ) ) ; expect ( result . current . initial ) . toBe ( true ) ; expect ( result . current . loading ) . toBe ( false ) ; expect ( result . current . ready ) . toBe ( false ) ; expect ( result . current . idle ) . toBe ( false ) ; expect ( result . current . playing ) . toBe ( false ) ; expect ( result . current . paused ) . toBe ( false ) ; expect ( result . current . end ) . toBe ( false ) ; } ) ; } ) ;