Skip to content

Commit

Permalink
fix: added testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
likhith-deriv committed Jan 5, 2024
1 parent 42eee36 commit 8318c61
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
36 changes: 36 additions & 0 deletions packages/account/src/Configs/__test__/terms-of-use-config.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import termsOfUseConfig from '../terms-of-use-config';

jest.mock('@deriv/shared', () => ({
...jest.requireActual('@deriv/shared'),
getDefaultFields: jest.fn(),
}));

describe('terms-of-use-config', () => {
const MockComponent = jest.fn();

it('should set the is_multi_account value to true', () => {
const account_settings = {
fatca_declaration: 0,
};
const config = termsOfUseConfig(
{
real_account_signup_target: 'maltainvest',
account_settings,
},
MockComponent
);
expect(config.props.is_multi_account).toBeTruthy();
});

it('should set the is_multi_account value to false', () => {
const account_settings = {};
const config = termsOfUseConfig(
{
real_account_signup_target: 'maltainvest',
account_settings,
},
MockComponent
);
expect(config.props.is_multi_account).toBeFalsy();
});
});
4 changes: 2 additions & 2 deletions packages/account/src/Configs/terms-of-use-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { getDefaultFields, isDesktop } from '@deriv/shared';
import { localize } from '@deriv/translations';
import { GetSettings } from '@deriv/api-types';

type TTermsOfConfigSettings = GetSettings & { fatca_declaration: 0 | 1 };
type TTermsOfConfigSettings = GetSettings & { fatca_declaration: number };

const getTermsOfUseConfig = (account_settings: TTermsOfConfigSettings) => ({
const getTermsOfUseConfig = (account_settings: Partial<TTermsOfConfigSettings>) => ({
agreed_tos: {
supported_in: ['svg', 'maltainvest'],
default_value: false,
Expand Down

0 comments on commit 8318c61

Please sign in to comment.