import { render } from '@testing-library/react-native';
import { Text } from 'react-native';
import { CSMask } from '../../../replay/masking/CSMask.android.tsx';
import CSMaskedView from '../../../replay/masking/CSMaskedView.tsx';
import CSUnmaskedView from '../../../replay/masking/CSUnmaskedView.tsx';
jest.mock('../../../replay/masking/CSMaskedView', () =>
jest.fn(({ children }) => <>{children}>)
);
jest.mock('../../../replay/masking/CSUnmaskedView', () =>
jest.fn(({ children }) => <>{children}>)
);
describe('CSMask', () => {
beforeEach(() => {
jest.clearAllMocks();
});
it('should render CSMaskedView when isMasking is true', () => {
const { getByText } = render(
Masked content
);
expect(CSMaskedView).toHaveBeenCalled();
expect(CSUnmaskedView).not.toHaveBeenCalled();
expect(getByText('Masked content')).toBeTruthy();
});
it('should render CSUnmaskedView when isMasking is false', () => {
const { getByText } = render(
Unmasked content
);
expect(CSUnmaskedView).toHaveBeenCalled();
expect(CSMaskedView).not.toHaveBeenCalled();
expect(getByText('Unmasked content')).toBeTruthy();
});
it('should render CSMaskedView when isMasking is not provided', () => {
const { getByText } = render(
Default masking
);
expect(CSMaskedView).toHaveBeenCalled();
expect(CSUnmaskedView).not.toHaveBeenCalled();
expect(getByText('Default masking')).toBeTruthy();
});
});