-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:binary-com/deriv-app into shayan/…
…52349/react17-migration
- Loading branch information
Showing
71 changed files
with
1,306 additions
and
1,155 deletions.
There are no files selected for viewing
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
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
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
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
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
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
72 changes: 36 additions & 36 deletions
72
packages/cashier/src/containers/routes/__tests__/route-with-sub-routes.spec.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 |
---|---|---|
@@ -1,48 +1,48 @@ | ||
// TODO refactor old tests in this component | ||
import React from 'react'; | ||
import { RouteWithSubRoutesRender } from '../route-with-sub-routes'; | ||
import { MemoryRouter, Redirect } from 'react-router-dom'; | ||
import { render } from '@testing-library/react'; | ||
import { Redirect } from 'react-router-dom'; | ||
import { render, screen } from '@testing-library/react'; | ||
import RouteWithSubRoutes from '../route-with-sub-routes'; | ||
|
||
type TMockFunction = { | ||
path: string; | ||
exact?: boolean; | ||
}; | ||
|
||
jest.mock('react-router-dom', () => ({ | ||
...jest.requireActual('react-router-dom'), | ||
Route: jest.fn(({ path, exact }: TMockFunction) => ( | ||
<div> | ||
<span>{`path param: ${path}`}</span> | ||
<span>{`exact param: ${exact}`}</span> | ||
</div> | ||
)), | ||
})); | ||
|
||
afterEach(() => jest.clearAllMocks()); | ||
|
||
const mockFunction = jest.fn(); | ||
const route = { | ||
getTitle: mockFunction, | ||
getTitle: jest.fn(), | ||
component: Redirect, | ||
is_logging_in: true, | ||
is_logged_in: true, | ||
exact: true, | ||
path: '/', | ||
to: '/root', | ||
path: '/test-path', | ||
}; | ||
|
||
const MockComponent = () => ( | ||
<MemoryRouter> | ||
<RouteWithSubRoutesRender {...route} /> | ||
</MemoryRouter> | ||
); | ||
const MockRouteWithSubRoutes = () => <RouteWithSubRoutes {...route} />; | ||
|
||
describe('<RouteWithSubRoutes />', () => { | ||
it('should render one <RouteWithSubRoutesRender /> component', () => { | ||
render(<MockComponent />); | ||
describe('RouteWithSubRoutes component', () => { | ||
it('should render the "RouteWithSubRoutes" component', () => { | ||
render(<MockRouteWithSubRoutes />); | ||
const span_element = screen.getByText(/path param: \/test-path/i); | ||
expect(span_element).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
// import React from 'react'; | ||
// import { RouteWithSubRoutesRender } from '../route-with-sub-routes'; | ||
// import { Redirect } from 'react-router-dom'; | ||
|
||
// configure({ adapter: new Adapter() }); | ||
|
||
// describe('<RouteWithSubRoutes />', () => { | ||
// it('should render one <RouteWithSubRoutesRender /> component', () => { | ||
// const wrapper = shallow(<RouteWithSubRoutesRender />); | ||
// expect(wrapper).toHaveLength(1); | ||
// }); | ||
// it('should have props as passed as route', () => { | ||
// const route = { path: '/', component: Redirect, title: '', exact: true, to: '/root' }; | ||
// const wrapper = shallow(<RouteWithSubRoutesRender {...route} />); | ||
// expect(wrapper.prop('exact')).toBe(true); | ||
// expect(wrapper.prop('path')).toBe('/'); | ||
// expect(wrapper.prop('render')).toBeInstanceOf(Function); | ||
// }); | ||
// }); | ||
it('should render properties', () => { | ||
render(<MockRouteWithSubRoutes />); | ||
const path_param = screen.getByText(/\/test-path/i); | ||
const exact_param = screen.getByText(/exact param: true/i); | ||
expect(path_param).toBeInTheDocument(); | ||
expect(exact_param).toBeInTheDocument(); | ||
}); | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { TRootStore } from '@deriv/stores/types'; | ||
import type CFDStore from './src/Stores/Modules/CFD/cfd-store'; | ||
|
||
declare module '@deriv/stores' { | ||
export function useStore(): TRootStore & { | ||
modules: { | ||
cfd: CFDStore; | ||
}; | ||
}; | ||
} |
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
Oops, something went wrong.