/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format * @oncall react_native */ 'use strict'; const render = require('../../../../jest/renderer'); const LogBoxMessage = require('../LogBoxMessage').default; const React = require('react'); describe('LogBoxMessage', () => { it('should render message', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render message truncated to 6 chars', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render the whole message when maxLength = message length', () => { const message = 'Some kind of message'; const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render message with substitution', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render message with substitution, truncating the first word 3 letters in', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render message with substitution, truncating the second word 6 letters in', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render message with substitution, truncating the third word 2 letters in', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render the whole message with substitutions when maxLength = message length', () => { const message = 'normal substitution normal'; const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render a plaintext message with no substitutions', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('should render a plaintext message and clean the content', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('Should strip "TransformError " without breaking substitution', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('Should strip "Warning: " without breaking substitution', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); it('Should strip "Warning: Warning: " without breaking substitution', () => { const output = render.shallowRender( , ); expect(output).toMatchSnapshot(); }); });