mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-04-20 03:00:24 -04:00
* INJIMOB-3792: Added tests increase code coverage Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792 Test-covrage fix Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792 Fix failing snapshot test Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792: Test-coverage suggestion fix Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792 code-coverage reviews fixes Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792 Refractoring test files for coverage enhancement Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792 Refractoring changes for code-coverage Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792 Refractoring changes in test files for code-coverage Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792 Fix snapshot test files for code-coverage Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> * INJIMOB-3792 Enhance test files for better code-coverage Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> --------- Signed-off-by: Kaushik Gupta <146950347+Kaushikgupta469@users.noreply.github.com> Signed-off-by: Swati Goel <meet2swati@gmail.com> Co-authored-by: Swati Goel <meet2swati@gmail.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import {render} from '@testing-library/react-native';
|
|
import {DeviceInfoList, DeviceInfo} from './DeviceInfoList';
|
|
|
|
describe('DeviceInfoList Component', () => {
|
|
const mockDeviceInfo: DeviceInfo = {
|
|
deviceName: 'Samsung Galaxy S21',
|
|
name: 'John Doe',
|
|
deviceId: 'device123',
|
|
};
|
|
|
|
it('should render DeviceInfoList component', () => {
|
|
const {toJSON, getByText} = render(
|
|
<DeviceInfoList deviceInfo={mockDeviceInfo} />,
|
|
);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
expect(getByText('Samsung Galaxy S21')).toBeTruthy();
|
|
});
|
|
|
|
it('should render with receiver mode', () => {
|
|
const {toJSON, getByText} = render(
|
|
<DeviceInfoList deviceInfo={mockDeviceInfo} of="receiver" />,
|
|
);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
expect(getByText('requestedBy')).toBeTruthy();
|
|
});
|
|
|
|
it('should render with sender mode', () => {
|
|
const {toJSON, getByText} = render(
|
|
<DeviceInfoList deviceInfo={mockDeviceInfo} of="sender" />,
|
|
);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
expect(getByText('sentBy')).toBeTruthy();
|
|
});
|
|
|
|
it('should handle empty device name', () => {
|
|
const deviceInfo = {...mockDeviceInfo, deviceName: ''};
|
|
const {toJSON} = render(<DeviceInfoList deviceInfo={deviceInfo} />);
|
|
expect(toJSON()).toMatchSnapshot();
|
|
});
|
|
});
|