import React from 'react';
import {render} from '@testing-library/react-native';
import {SectionLayout} from './SectionLayout';
import {Text, View} from 'react-native';
// Mock ui components
jest.mock('./ui', () => ({
Column: ({children}: {children: React.ReactNode}) => <>{children}>,
Row: ({children}: {children: React.ReactNode}) => <>{children}>,
Text: ({children}: {children: React.ReactNode}) => <>{children}>,
}));
describe('SectionLayout Component', () => {
const defaultProps = {
headerIcon: Icon,
headerText: 'Section Header',
children: Section Content,
testId: 'testSection',
};
it('should match snapshot with default props', () => {
const {toJSON} = render();
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with custom marginBottom', () => {
const {toJSON} = render(
,
);
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with different header text', () => {
const {toJSON} = render(
,
);
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with complex children', () => {
const {toJSON} = render(
Line 1
Line 2
Nested content
,
);
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with different icon', () => {
const customIcon = 🔍;
const {toJSON} = render(
,
);
expect(toJSON()).toMatchSnapshot();
});
it('should match snapshot with zero marginBottom', () => {
const {toJSON} = render(
,
);
expect(toJSON()).toMatchSnapshot();
});
});