-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kate / WEBREL-51 / Test coverage: ProgressSliderStream in Trader pack…
…age (#9464) * feat: add unit tests * refactor: incapsulated trade providers
- Loading branch information
1 parent
bd70a37
commit 3196e06
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
.../trader/src/App/Containers/ProgressSliderStream/__tests__/progress-slider-stream.spec.jsx
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,44 @@ | ||
import React from 'react'; | ||
import { screen, render } from '@testing-library/react'; | ||
import { mockStore } from '@deriv/stores'; | ||
import TraderProviders from '../../../../trader-providers'; | ||
import ProgressSliderStream from '../progress-slider-stream'; | ||
|
||
jest.mock('@deriv/components', () => ({ | ||
...jest.requireActual('@deriv/components'), | ||
ProgressSlider: () => <div>Mocked Progress Slider</div>, | ||
})); | ||
|
||
const contract_info = { | ||
contract_type: 'TEST', | ||
date_expiry: 1222222224, | ||
date_start: 1222222222, | ||
tick_count: 2, | ||
tick_stream: [ | ||
{ epoch: 1, tick: 1, tick_display_value: '300' }, | ||
{ epoch: 2, tick: 2, tick_display_value: '302' }, | ||
], | ||
}; | ||
|
||
describe('<ProgressSliderStream />', () => { | ||
const mockProgressSliderStream = (mocked_store, contract_info = null) => { | ||
return ( | ||
<TraderProviders store={mocked_store}> | ||
<ProgressSliderStream contract_info={contract_info} /> | ||
</TraderProviders> | ||
); | ||
}; | ||
|
||
it('should not render <ProgressSliderStream /> if contract_info is falsy', () => { | ||
const mock_root_store = mockStore({}); | ||
render(mockProgressSliderStream(mock_root_store)); | ||
|
||
expect(screen.queryByText('Mocked Progress Slider')).not.toBeInTheDocument(); | ||
}); | ||
it('should render <ProgressSliderStream /> if contract_info was passed in props', () => { | ||
const mock_root_store = mockStore({}); | ||
render(mockProgressSliderStream(mock_root_store, contract_info)); | ||
|
||
expect(screen.getByText('Mocked Progress Slider')).toBeInTheDocument(); | ||
}); | ||
}); |
3196e06
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
deriv-app – ./
deriv-app.vercel.app
binary.sx
deriv-app.binary.sx
deriv-app-git-master.binary.sx