Skip to content

Commit

Permalink
Test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeop committed Apr 22, 2022
1 parent 4c7d931 commit 0c88cff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Play Queue container', () => {
store.clear();
});

it('should display with track in queue', async () => {
it('should display tracks in the queue', async () => {
const { component } = mountComponent();
expect(component.asFragment()).toMatchSnapshot();
});
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('Play Queue container', () => {
expect(component.asFragment()).toMatchSnapshot();
});

it('should copy original track url to clipboard', async () => {
it('should copy the original track url to clipboard', async () => {
const { component } = mountComponent();
// eslint-disable-next-line @typescript-eslint/no-var-requires
const clipboard = require('electron').clipboard;
Expand All @@ -57,7 +57,7 @@ describe('Play Queue container', () => {
expect(clipboard.writeText).toHaveBeenCalledWith('https://test-track-original-url');
});

it('should not display copy original track url button if the url is not included in the current stream', async () => {
it('should not display the copy original track url button if the url is not included in the current stream', async () => {
const { component } = mountComponent();
const track = component.getByTestId('queue-popup-uuid2');
await waitFor(() => fireEvent.contextMenu(track));
Expand Down Expand Up @@ -123,6 +123,16 @@ describe('Play Queue container', () => {
]);
});

it('should clear the queue', async () => {
const { component, store } = mountComponent();

await waitFor(() => component.getByTestId('queue-menu-more-container').click());
await waitFor(() => component.getByText(/Clear queue/i).click());

const state = store.getState();
expect(state.queue.queueItems).toEqual([]);
});

const mountComponent = (initialStore?: AnyProps) => {
const initialState = initialStore || buildStoreState()
.withTracksInPlayQueue()
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/stories/components/searchbox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ storiesOf('Components/Search box', module)
<SearchBox
{...commonProps}
selectedSearchProvider={selectedSearchProvider}
onSearchProviderSelect={(_, data) => onSearchProviderSelect(searchProviders.find((provider) => provider.value === data.value))}
onSearchProviderSelect={(data) => onSearchProviderSelect(searchProviders.find((provider) => provider.value === data.value))}
/>
</div>;
})
Expand All @@ -29,7 +29,7 @@ storiesOf('Components/Search box', module)
return <div className='bg'><SearchBox
{...commonProps}
selectedSearchProvider={selectedSearchProvider}
onSearchProviderSelect={(_, data) => onSearchProviderSelect(searchProviders.find((provider) => provider.value === data.value))}
onSearchProviderSelect={(data) => onSearchProviderSelect(searchProviders.find((provider) => provider.value === data.value))}
loading
/>
</div>;
Expand All @@ -39,7 +39,7 @@ storiesOf('Components/Search box', module)
return <div className='bg'><SearchBox
{...commonProps}
selectedSearchProvider={selectedSearchProvider}
onSearchProviderSelect={(_, data) => onSearchProviderSelect(searchProviders.find((provider) => provider.value === data.value))}
onSearchProviderSelect={(data) => onSearchProviderSelect(searchProviders.find((provider) => provider.value === data.value))}
disabled
/>
</div>;
Expand Down

0 comments on commit 0c88cff

Please sign in to comment.