Files
react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorMesageHeader-test.js
T
Rick Hanlon 3c525d5b17 LogBox - Display errors for notifications and inspector
Summary:
This diff adds and displays errors in LogBox. We will now toast both warnings and errors, open errors for inspection, and allow paginating through errors and warnings.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18091519

fbshipit-source-id: c155969dc505de5cfb0e95bb5a8221b9f8cfe4f7
2019-10-28 10:10:55 -07:00

81 lines
1.8 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @emails oncall+react_native
* @flow
*/
'use strict';
const React = require('react');
const LogBoxInspectorMessageHeader = require('../LogBoxInspectorMessageHeader')
.default;
const render = require('../../../../jest/renderer');
describe('LogBoxInspectorMessageHeader', () => {
it('should not render error', () => {
const output = render.shallowRender(
<LogBoxInspectorMessageHeader
level="error"
collapsed={false}
message={{
content: 'Short',
substitutions: [],
}}
onPress={() => {}}
/>,
);
expect(output).toMatchSnapshot();
});
it('should not render collapse button for short content', () => {
const output = render.shallowRender(
<LogBoxInspectorMessageHeader
level="warn"
collapsed={false}
message={{
content: 'Short',
substitutions: [],
}}
onPress={() => {}}
/>,
);
expect(output).toMatchSnapshot();
});
it('should render "collapse" if expanded', () => {
const output = render.shallowRender(
<LogBoxInspectorMessageHeader
level="warn"
collapsed={false}
message={{content: '#'.repeat(200), substitutions: []}}
onPress={() => {}}
/>,
);
expect(output).toMatchSnapshot();
});
it('should render "see more" if collapsed', () => {
const output = render.shallowRender(
<LogBoxInspectorMessageHeader
level="warn"
collapsed={true}
message={{
content: '#'.repeat(200),
substitutions: [],
}}
onPress={() => {}}
/>,
);
expect(output).toMatchSnapshot();
});
});