forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Amina/comp 515/amend financial information dropdown (deriv-com#10360)
* fix: set form values * fix: common formating function * fix: add id * fix: aa * fix: account signup * fix: revert unrelated file change * fix: test case * fix: revert eslint fix on unrelated files * fix: revert eslint fix on unrelated files * fix: revert eslint fix on unrelated files * fix: merge master * fix: function to common * fix: mobile * fix: validation * fix: add optional parameter * fix: eslint * chore: merge master
- Loading branch information
1 parent
4f51e97
commit f6f566f
Showing
8 changed files
with
274 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const EMPLOYMENT_VALUES = { | ||
EMPLOYED: 'Employed', | ||
UNEMPLOYED: 'Unemployed', | ||
}; |
75 changes: 75 additions & 0 deletions
75
...count/src/Sections/Assessment/FinancialAssessment/__tests__/financial-assessment.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,75 @@ | ||
import React from 'react'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import { StoreProvider, mockStore } from '@deriv/stores'; | ||
import FinancialAssessment from '../financial-assessment'; | ||
|
||
jest.mock('@deriv/shared/src/services/ws-methods', () => ({ | ||
__esModule: true, | ||
default: 'mockedDefaultExport', | ||
WS: { | ||
wait: jest.fn(() => Promise.resolve()), | ||
setSettings: jest.fn(() => Promise.resolve({ error: '' })), | ||
authorized: { | ||
storage: { | ||
getFinancialAssessment: jest.fn(() => | ||
Promise.resolve({ | ||
get_financial_assessment: { | ||
account_turnover: '', | ||
cfd_score: 0, | ||
education_level: '', | ||
employment_industry: '', | ||
employment_status: 'Employed', | ||
estimated_worth: '', | ||
financial_information_score: '', | ||
income_source: '', | ||
net_income: '', | ||
occupation: '', | ||
source_of_wealth: '', | ||
total_score: '', | ||
trading_score: '', | ||
}, | ||
}) | ||
), | ||
}, | ||
}, | ||
}, | ||
useWS: () => undefined, | ||
})); | ||
jest.mock('@deriv/components', () => { | ||
const original_module = jest.requireActual('@deriv/components'); | ||
return { | ||
...original_module, | ||
Loading: jest.fn(() => 'mockedLoading'), | ||
}; | ||
}); | ||
describe('<FinancialAssessment/>', () => { | ||
const mock = mockStore({}); | ||
const rendercomponent = () => { | ||
const wrapper = ({ children }: { children: JSX.Element }) => ( | ||
<StoreProvider store={mock}>{children}</StoreProvider> | ||
); | ||
render( | ||
<BrowserRouter> | ||
<FinancialAssessment /> | ||
</BrowserRouter>, | ||
{ wrapper } | ||
); | ||
}; | ||
it('should render FinancialAssessment component', async () => { | ||
rendercomponent(); | ||
await waitFor(() => { | ||
expect(screen.getByText('Financial information')).toBeInTheDocument(); | ||
expect(screen.getByText('Source of income')).toBeInTheDocument(); | ||
expect(screen.getByText('Employment status')).toBeInTheDocument(); | ||
expect(screen.getByText('Industry of employment')).toBeInTheDocument(); | ||
expect(screen.getByText('Occupation')).toBeInTheDocument(); | ||
expect(screen.getByText('Source of wealth')).toBeInTheDocument(); | ||
expect(screen.getByText('Level of education')).toBeInTheDocument(); | ||
expect(screen.getByText('Net annual income')).toBeInTheDocument(); | ||
expect(screen.getByText('Source of wealth')).toBeInTheDocument(); | ||
expect(screen.getByText('Estimated net worth')).toBeInTheDocument(); | ||
expect(screen.getByText('Anticipated account turnover')).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.