mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 05:27:57 -05:00
* INJIMOB-3246 Code coverage for Inji-Wallet repo increase above 5% Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * INJIMOB-3246: added snapshot tests and coverage increased to +4% Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * removed duplicated lines Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * Added updateCredentialInformation tests Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * added code rabbit changes Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * removed platform-specific tests without mocking Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> * standardize mocks in VcItemContainerProfileImage tests Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com> --------- Signed-off-by: Kaushik Gupta <kausgpt97@gmail.com>
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import {render} from '@testing-library/react-native';
|
|
import {ProfileIcon} from './ProfileIcon';
|
|
import {View} from 'react-native';
|
|
|
|
// Mock SvgImage
|
|
jest.mock('./ui/svg', () => ({
|
|
SvgImage: {
|
|
pinIcon: jest.fn(() => <View testID="mockPinIcon" />),
|
|
},
|
|
}));
|
|
|
|
describe('ProfileIcon Component', () => {
|
|
const defaultProps = {
|
|
profileIconContainerStyles: {},
|
|
profileIconSize: 40,
|
|
};
|
|
|
|
it('should match snapshot without pinned icon', () => {
|
|
const {toJSON} = render(<ProfileIcon {...defaultProps} />);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
});
|
|
|
|
it('should match snapshot with pinned icon', () => {
|
|
const {toJSON} = render(<ProfileIcon {...defaultProps} isPinned={true} />);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
});
|
|
|
|
it('should match snapshot with custom icon size', () => {
|
|
const {toJSON} = render(
|
|
<ProfileIcon {...defaultProps} profileIconSize={60} />,
|
|
);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
});
|
|
|
|
it('should match snapshot with custom container styles', () => {
|
|
const customStyles = {
|
|
backgroundColor: 'blue',
|
|
borderRadius: 10,
|
|
padding: 5,
|
|
};
|
|
const {toJSON} = render(
|
|
<ProfileIcon
|
|
{...defaultProps}
|
|
profileIconContainerStyles={customStyles}
|
|
/>,
|
|
);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
});
|
|
});
|