-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Resolved Duration Bug * Writing test for PlayerBar controller
- Loading branch information
1 parent
0dcd647
commit d657404
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
packages/app/app/containers/PlayerBarContainer/PlayerBarContainer.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { SemanticICONS } from 'semantic-ui-react/dist/commonjs/generic'; | ||
import { AnyProps, setupI18Next, TestStoreProvider } from '../../../test/testUtils'; | ||
import PlayerBarContainer from '.'; | ||
|
||
describe('PlayerBar container', () => { | ||
beforeAll(() => { | ||
setupI18Next(); | ||
}); | ||
|
||
it('should display no time stamp if rendertrackDuration is false', () => { | ||
const component = mountComponent({ | ||
renderTrackDuration: false | ||
}); | ||
|
||
expect(component.getByText('00:00')).toBeNull; | ||
}); | ||
|
||
const mountComponent = (initialStore?: AnyProps) => { | ||
const component = render(<TestStoreProvider | ||
initialState={initialStore ?? { | ||
renderTrackDuration: true, | ||
timePlayed: '-3:14', | ||
timeToEnd: '2:43', | ||
fill: 66, | ||
track: 'Test song', | ||
artist: 'Test artist', | ||
cover: 'https://i.imgur.com/4euOws2.jpg', | ||
volume: 60, | ||
queue: { queueItems: [] }, | ||
playOptions: [ | ||
{ icon: ('repeat' as SemanticICONS), enabled: false, name: 'Repeat' }, | ||
{ icon: ('magic' as SemanticICONS), name: 'Autoradio' }, | ||
{ icon: ('random' as SemanticICONS), enabled: false, name: 'Shuffle' } | ||
], | ||
isMuted: false | ||
} | ||
} | ||
> | ||
<PlayerBarContainer /> | ||
</TestStoreProvider>); | ||
return component; | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters