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>
86 lines
2.6 KiB
TypeScript
86 lines
2.6 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} = render(<DeviceInfoList deviceInfo={mockDeviceInfo} />);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
|
|
it('should render with receiver mode', () => {
|
|
const {toJSON} = render(
|
|
<DeviceInfoList deviceInfo={mockDeviceInfo} of="receiver" />,
|
|
);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
|
|
it('should render with sender mode', () => {
|
|
const {toJSON} = render(
|
|
<DeviceInfoList deviceInfo={mockDeviceInfo} of="sender" />,
|
|
);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
|
|
it('should render without of prop', () => {
|
|
const {toJSON} = render(<DeviceInfoList deviceInfo={mockDeviceInfo} />);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
|
|
it('should handle different device names', () => {
|
|
const deviceNames = [
|
|
'iPhone 14 Pro',
|
|
'Google Pixel 7',
|
|
'OnePlus 11',
|
|
'Samsung Galaxy S23',
|
|
];
|
|
|
|
deviceNames.forEach(deviceName => {
|
|
const deviceInfo = {...mockDeviceInfo, deviceName};
|
|
const {toJSON} = render(<DeviceInfoList deviceInfo={deviceInfo} />);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
it('should handle different user names', () => {
|
|
const names = ['Alice Smith', 'Bob Johnson', 'Charlie Brown'];
|
|
|
|
names.forEach(name => {
|
|
const deviceInfo = {...mockDeviceInfo, name};
|
|
const {toJSON} = render(<DeviceInfoList deviceInfo={deviceInfo} />);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
it('should handle different device IDs', () => {
|
|
const deviceIds = ['device001', 'device002', 'device003'];
|
|
|
|
deviceIds.forEach(deviceId => {
|
|
const deviceInfo = {...mockDeviceInfo, deviceId};
|
|
const {toJSON} = render(<DeviceInfoList deviceInfo={deviceInfo} />);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
it('should handle empty device name', () => {
|
|
const deviceInfo = {...mockDeviceInfo, deviceName: ''};
|
|
const {toJSON} = render(<DeviceInfoList deviceInfo={deviceInfo} />);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
|
|
it('should handle long device names', () => {
|
|
const deviceInfo = {
|
|
...mockDeviceInfo,
|
|
deviceName: 'Very Long Device Name With Many Characters',
|
|
};
|
|
const {toJSON} = render(<DeviceInfoList deviceInfo={deviceInfo} />);
|
|
expect(toJSON()).toBeTruthy();
|
|
});
|
|
});
|