mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 21:48:04 -05:00
INJIMOB-3246 Code coverage for Inji-Wallet repo increase above 5% (#2108)
* 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>
This commit is contained in:
71
components/VcItemContainerProfileImage.test.tsx
Normal file
71
components/VcItemContainerProfileImage.test.tsx
Normal file
@@ -0,0 +1,71 @@
|
||||
import React from 'react';
|
||||
import {render} from '@testing-library/react-native';
|
||||
import {VcItemContainerProfileImage} from './VcItemContainerProfileImage';
|
||||
import {View} from 'react-native';
|
||||
|
||||
// Mock SvgImage
|
||||
jest.mock('./ui/svg', () => ({
|
||||
SvgImage: {
|
||||
pinIcon: jest.fn(() => <View testID="mockPinIcon" />),
|
||||
},
|
||||
}));
|
||||
|
||||
// Mock ProfileIcon
|
||||
jest.mock('./ProfileIcon', () => ({
|
||||
ProfileIcon: jest.fn(() => <View testID="mockProfileIcon" />),
|
||||
}));
|
||||
|
||||
describe('VcItemContainerProfileImage Component', () => {
|
||||
const vcDataWithImage = {
|
||||
face: 'https://example.com/avatar.jpg',
|
||||
};
|
||||
|
||||
const vcDataWithoutImage = {
|
||||
face: null,
|
||||
};
|
||||
|
||||
it('should match snapshot with face image', () => {
|
||||
const {toJSON} = render(
|
||||
<VcItemContainerProfileImage
|
||||
verifiableCredentialData={vcDataWithImage}
|
||||
/>,
|
||||
);
|
||||
expect(toJSON()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should match snapshot with face image and pinned', () => {
|
||||
const {toJSON} = render(
|
||||
<VcItemContainerProfileImage
|
||||
verifiableCredentialData={vcDataWithImage}
|
||||
isPinned={true}
|
||||
/>,
|
||||
);
|
||||
expect(toJSON()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should match snapshot without face image', () => {
|
||||
const {toJSON} = render(
|
||||
<VcItemContainerProfileImage
|
||||
verifiableCredentialData={vcDataWithoutImage}
|
||||
/>,
|
||||
);
|
||||
expect(toJSON()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should match snapshot without face image and pinned', () => {
|
||||
const {toJSON} = render(
|
||||
<VcItemContainerProfileImage
|
||||
verifiableCredentialData={vcDataWithoutImage}
|
||||
isPinned={true}
|
||||
/>,
|
||||
);
|
||||
expect(toJSON()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should match snapshot with empty string face', () => {
|
||||
const {toJSON} = render(
|
||||
<VcItemContainerProfileImage verifiableCredentialData={{face: ''}} />,
|
||||
);
|
||||
expect(toJSON()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user