import { render } from '@testing-library/react-native'; import * as React from 'react'; import View from '../../primitives/View'; import { createSafeStyledView } from '../createSafeStyledView'; const Safe = createSafeStyledView(View); const originalConsoleError = console.error; const originalConsoleWarn = console.warn; beforeEach(() => { console.error = jest.fn(); console.warn = jest.fn(); }); afterAll(() => { console.error = originalConsoleError; console.warn = originalConsoleWarn; }); it('strips invalid style properties', () => { const { toJSON } = render( ); expect(toJSON()).toMatchSnapshot(); }); it('replaces invalid position with "relative"', () => { const { toJSON } = render( ); expect(toJSON()).toMatchSnapshot(); expect(console.warn).toHaveBeenCalledWith(`Unsupported position: 'fixed'`); }); it('mocks out visibility: hidden by lowering the opacity', () => { const { toJSON } = render( ); expect(toJSON()).toMatchSnapshot(); });