Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ const render = require('../../../../jest/renderer');
const LogBoxButton = require('../LogBoxButton').default;
const React = require('react');

// Mock `TouchableWithoutFeedback` because we are interested in snapshotting the
// behavior of `LogBoxButton`, not `TouchableWithoutFeedback`.
jest.mock('../../../Components/Touchable/TouchableWithoutFeedback', () => ({
__esModule: true,
default: 'TouchableWithoutFeedback',
}));

describe('LogBoxButton', () => {
it('should render only a view without an onPress', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxButton
backgroundColor={{
default: 'black',
Expand All @@ -31,7 +38,7 @@ describe('LogBoxButton', () => {
});

it('should render TouchableWithoutFeedback and pass through props', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxButton
backgroundColor={{
default: 'black',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ const LogBoxInspectorMessageHeader =
require('../LogBoxInspectorMessageHeader').default;
const React = require('react');

// Mock `LogBoxMessage` because we are interested in snapshotting the
// behavior of `LogBoxInspectorMessageHeader`, not `LogBoxMessage`.
jest.mock('../LogBoxMessage', () => ({
__esModule: true,
default: 'LogBoxMessage',
}));

describe('LogBoxInspectorMessageHeader', () => {
it('should render error', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxInspectorMessageHeader
title="Error"
level="error"
Expand All @@ -35,7 +42,7 @@ describe('LogBoxInspectorMessageHeader', () => {
});

it('should render fatal', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxInspectorMessageHeader
title="Fatal Error"
level="fatal"
Expand All @@ -52,7 +59,7 @@ describe('LogBoxInspectorMessageHeader', () => {
});

it('should render syntax error', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxInspectorMessageHeader
title="Syntax Error"
level="syntax"
Expand All @@ -69,7 +76,7 @@ describe('LogBoxInspectorMessageHeader', () => {
});

it('should not render See More button for short content', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxInspectorMessageHeader
title="Warning"
level="warn"
Expand All @@ -86,7 +93,7 @@ describe('LogBoxInspectorMessageHeader', () => {
});

it('should not render "See More" if expanded', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxInspectorMessageHeader
title="Warning"
level="warn"
Expand All @@ -100,7 +107,7 @@ describe('LogBoxInspectorMessageHeader', () => {
});

it('should render "See More" if collapsed', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxInspectorMessageHeader
title="Warning"
level="warn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,24 @@ const {
} = require('../LogBoxNotificationContainer');
const React = require('react');

// Mock `LogBoxLogNotification` because we are interested in snapshotting the
// behavior of `LogBoxNotificationContainer`, not `LogBoxLogNotification`.
jest.mock('../UI/LogBoxNotification', () => ({
__esModule: true,
default: 'LogBoxLogNotification',
}));

describe('LogBoxNotificationContainer', () => {
it('should render null with no logs', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxNotificationContainer selectedLogIndex={-1} logs={[]} />,
);

expect(output).toMatchSnapshot();
});

it('should render null with no selected log and disabled', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxNotificationContainer
isDisabled
selectedLogIndex={-1}
Expand All @@ -52,7 +59,7 @@ describe('LogBoxNotificationContainer', () => {
});

it('should render the latest warning notification', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxNotificationContainer
selectedLogIndex={-1}
logs={[
Expand Down Expand Up @@ -86,7 +93,7 @@ describe('LogBoxNotificationContainer', () => {
});

it('should render the latest error notification', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxNotificationContainer
selectedLogIndex={-1}
logs={[
Expand Down Expand Up @@ -120,7 +127,7 @@ describe('LogBoxNotificationContainer', () => {
});

it('should render both an error and warning notification', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxNotificationContainer
selectedLogIndex={-1}
logs={[
Expand Down Expand Up @@ -154,7 +161,7 @@ describe('LogBoxNotificationContainer', () => {
});

it('should render selected fatal error even when disabled', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxNotificationContainer
isDisabled
selectedLogIndex={0}
Expand All @@ -178,7 +185,7 @@ describe('LogBoxNotificationContainer', () => {
});

it('should render selected syntax error even when disabled', () => {
const output = render.shallowRender(
const output = render.create(
<LogBoxNotificationContainer
isDisabled
selectedLogIndex={0}
Expand Down