Files
inji-wallet/components/Message.test.tsx
Kaushik Gupta 33c6caa08a 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>
2025-11-07 11:10:37 +05:30

44 lines
1.4 KiB
TypeScript

import React from 'react';
import {render} from '@testing-library/react-native';
import {Message} from './Message';
// Mock LinearProgress
jest.mock('react-native-elements', () => ({
LinearProgress: jest.fn(() => null),
}));
// Mock Button from ui
jest.mock('./ui', () => ({
Button: jest.fn(() => null),
Centered: ({children}: {children: React.ReactNode}) => <>{children}</>,
Column: ({children}: {children: React.ReactNode}) => <>{children}</>,
Text: ({children}: {children: React.ReactNode}) => <>{children}</>,
}));
describe('Message Component', () => {
it('should match snapshot with title only', () => {
const {toJSON} = render(<Message title="Test Title" />);
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with message only', () => {
const {toJSON} = render(<Message message="Test Message" />);
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with title and message', () => {
const {toJSON} = render(<Message title="Title" message="Message" />);
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with hint text', () => {
const {toJSON} = render(<Message message="Test" hint="Hint text" />);
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with cancel button', () => {
const {toJSON} = render(<Message message="Test" onCancel={jest.fn()} />);
expect(toJSON()).toMatchSnapshot();
});
});