mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-07 20:53:54 -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>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import {render} from '@testing-library/react-native';
|
|
import {CopyButton} from './CopyButton';
|
|
|
|
// Mock Clipboard
|
|
jest.mock('@react-native-clipboard/clipboard', () => ({
|
|
setString: jest.fn(),
|
|
}));
|
|
|
|
// Mock SvgImage
|
|
jest.mock('./ui/svg', () => ({
|
|
SvgImage: {
|
|
copyIcon: jest.fn(() => null),
|
|
},
|
|
}));
|
|
|
|
describe('CopyButton Component', () => {
|
|
const defaultProps = {
|
|
content: 'Test content to copy',
|
|
};
|
|
|
|
it('should match snapshot with default props', () => {
|
|
const {toJSON} = render(<CopyButton {...defaultProps} />);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
});
|
|
|
|
it('should match snapshot with long content', () => {
|
|
const {toJSON} = render(
|
|
<CopyButton content="This is a very long content string that needs to be copied to clipboard for testing purposes" />,
|
|
);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
});
|
|
|
|
it('should match snapshot with special characters', () => {
|
|
const specialContent = 'Special: @#$%^&*(){}[]';
|
|
const {toJSON} = render(<CopyButton content={specialContent} />);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
});
|
|
});
|