Files
inji-wallet/components/RotatingIcon.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

100 lines
2.3 KiB
TypeScript

import React from 'react';
import {render} from '@testing-library/react-native';
import {RotatingIcon} from './RotatingIcon';
describe('RotatingIcon Component', () => {
it('should render RotatingIcon component', () => {
const {toJSON} = render(
<RotatingIcon name="sync" size={24} color="#000000" clockwise={true} />,
);
expect(toJSON()).toBeTruthy();
});
it('should render with clockwise rotation', () => {
const {toJSON} = render(
<RotatingIcon
name="refresh"
size={30}
color="#FF0000"
clockwise={true}
/>,
);
expect(toJSON()).toBeTruthy();
});
it('should render with counter-clockwise rotation', () => {
const {toJSON} = render(
<RotatingIcon
name="refresh"
size={30}
color="#0000FF"
clockwise={false}
/>,
);
expect(toJSON()).toBeTruthy();
});
it('should render with custom duration', () => {
const {toJSON} = render(
<RotatingIcon
name="sync"
size={24}
color="#00FF00"
clockwise={true}
duration={5000}
/>,
);
expect(toJSON()).toBeTruthy();
});
it('should render with default duration', () => {
const {toJSON} = render(
<RotatingIcon
name="loading"
size={20}
color="#CCCCCC"
clockwise={true}
/>,
);
expect(toJSON()).toBeTruthy();
});
it('should handle different icon names', () => {
const iconNames = ['sync', 'refresh', 'loading', 'autorenew'];
iconNames.forEach(name => {
const {toJSON} = render(
<RotatingIcon name={name} size={24} color="#000000" clockwise={true} />,
);
expect(toJSON()).toBeTruthy();
});
});
it('should handle different sizes', () => {
const sizes = [16, 24, 32, 48];
sizes.forEach(size => {
const {toJSON} = render(
<RotatingIcon
name="sync"
size={size}
color="#000000"
clockwise={true}
/>,
);
expect(toJSON()).toBeTruthy();
});
});
it('should handle different colors', () => {
const colors = ['#FF0000', '#00FF00', '#0000FF', '#FFFFFF'];
colors.forEach(color => {
const {toJSON} = render(
<RotatingIcon name="sync" size={24} color={color} clockwise={true} />,
);
expect(toJSON()).toBeTruthy();
});
});
});