-
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 aum/WAL…
…L-3952/fix-error-creating-mt5-financial-labuan-account
- Loading branch information
Showing
161 changed files
with
2,231 additions
and
2,082 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,8 @@ | ||
import React, { ComponentProps } from 'react'; | ||
import { Text } from '@deriv-com/ui'; | ||
|
||
export const LinkText = ({ children, ...rest }: ComponentProps<typeof Text>) => ( | ||
<Text as='a' color='red' rel='noreferrer' size='sm' target='_blank' {...rest}> | ||
{children} | ||
</Text> | ||
); |
11 changes: 11 additions & 0 deletions
11
packages/account-v2/src/components/LinkText/__tests__/LinkText.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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { LinkText } from '../LinkText'; | ||
|
||
describe('LinkText', () => { | ||
it('should render a link text', () => { | ||
render(<LinkText href='link_text'>Link Text</LinkText>); | ||
const linkText = screen.getByRole('link', { name: /Link Text/i }); | ||
expect(linkText).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
11 changes: 11 additions & 0 deletions
11
...account-v2/src/containers/AccountLimitsContainer/__tests__/AccountLimitsSideNote.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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { AccountLimitsSideNote } from '../AccountLimitsSideNote'; | ||
|
||
describe('AccountLimitsSideNote', () => { | ||
it('should render the side note component with the correct title and text', () => { | ||
render(<AccountLimitsSideNote />); | ||
expect(screen.getByText('Account limits')).toBeInTheDocument(); | ||
expect(screen.getByText('These are default limits that we apply to your accounts')).toBeInTheDocument(); | ||
}); | ||
}); |
49 changes: 49 additions & 0 deletions
49
...es/account-v2/src/containers/AccountLimitsContainer/__tests__/AccountLimitsTable.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { useDevice } from '@deriv-com/ui'; | ||
import { render, screen } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { mockFormattedAccountsLimits } from '../../../mocks/accountLimitsResponse.mock'; | ||
import { AccountLimitsTable } from '../AccountLimitsTable'; | ||
|
||
jest.mock('@deriv-com/ui', () => ({ | ||
...jest.requireActual('@deriv-com/ui'), | ||
useDevice: jest.fn(() => ({ isMobile: false })), | ||
})); | ||
|
||
describe('AccountLimitsTable', () => { | ||
it('should render the table with correct data', () => { | ||
render(<AccountLimitsTable accountLimitValues={mockFormattedAccountsLimits} />); | ||
expect(screen.getByText('Trading limits')).toBeInTheDocument(); | ||
expect(screen.getByText('*Maximum number of open positions')).toBeInTheDocument(); | ||
expect(screen.getByText('100')).toBeInTheDocument(); | ||
expect(screen.getByText('*Maximum account cash balance')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the hintInfo with Popover icon in desktop', () => { | ||
render(<AccountLimitsTable accountLimitValues={mockFormattedAccountsLimits} />); | ||
expect(screen.getAllByTestId('dt_account_limits_table_info_icon')).toHaveLength(4); | ||
}); | ||
|
||
it('should render the Popover message when icon is hovered in desktop', () => { | ||
render(<AccountLimitsTable accountLimitValues={mockFormattedAccountsLimits} />); | ||
const infoIcon = screen.queryAllByTestId('dt_account_limits_table_info_icon')[0]; | ||
expect(infoIcon).toBeInTheDocument(); | ||
userEvent.hover(infoIcon); | ||
expect( | ||
screen.getByText( | ||
'Represents the maximum number of outstanding contracts in your portfolio. Each line in your portfolio counts for one open position. Once the maximum is reached, you will not be able to open new positions without closing an existing position first.' | ||
) | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the hintInfo as description in mobile', () => { | ||
(useDevice as jest.Mock).mockReturnValue({ isMobile: true }); | ||
render(<AccountLimitsTable accountLimitValues={mockFormattedAccountsLimits} />); | ||
expect(screen.queryByTestId('dt_account_limits_table_info_icon')).not.toBeInTheDocument(); | ||
expect( | ||
screen.getByText( | ||
'Represents the maximum number of outstanding contracts in your portfolio. Each line in your portfolio counts for one open position. Once the maximum is reached, you will not be able to open new positions without closing an existing position first.' | ||
) | ||
).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
Oops, something went wrong.