Files
react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js
T
Rick Hanlon c5aa26da41 Add log level to support errors
Summary:
This diff adds a level to LogBox logs so that we can store and display errors in later diffs

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18091101

fbshipit-source-id: 21661d28a7945bdcb56702e2a03ab3612c11fe35
2019-10-28 10:10:54 -07:00

55 lines
1.2 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 LogBoxInspectorStackFrames = require('../LogBoxInspectorStackFrames')
.default;
const LogBoxLog = require('../../Data/LogBoxLog').default;
const render = require('../../../../jest/renderer');
const log = new LogBoxLog(
'warn',
{
content: 'Some kind of message (latest)',
substitutions: [],
},
[
{
column: 1,
file: 'dependency.js',
lineNumber: 1,
methodName: 'dep',
collapse: true,
},
{
column: 1,
file: 'app.js',
lineNumber: 1,
methodName: 'foo',
collapse: false,
},
],
'Some kind of message (latest)',
[],
);
describe('LogBoxInspectorStackFrame', () => {
it('should render stack frames with 1 frame collapsed', () => {
const output = render.shallowRender(
<LogBoxInspectorStackFrames onRetry={() => {}} log={log} />,
);
expect(output).toMatchSnapshot();
});
});