Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Eliminate yarn test spam #1024

Merged
merged 13 commits into from
Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix missing props in tests
  • Loading branch information
lieut-data committed Mar 28, 2018
commit c99562f11cb1d2f6c14cc328af80905feacd98f3
4 changes: 2 additions & 2 deletions components/sidebar/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export default class Sidebar extends React.PureComponent {
/**
* Current team object
*/
currentTeam: PropTypes.object.isRequired,
currentTeam: PropTypes.object,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code handles these not being present.


/**
* Current user object
*/
currentUser: PropTypes.object.isRequired,
currentUser: PropTypes.object,

/**
* Number of unread mentions/messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ exports[`components/channel_notifications_modal/ChannelNotificationsModal should
/>
<NotificationSection
expand={false}
memberNotificationLevel="all"
onChange={[Function]}
onSubmit={[Function]}
onUpdateSection={[Function]}
Expand Down
60 changes: 52 additions & 8 deletions tests/components/channel_notifications_modal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', ()
show: true,
onHide: () => {}, //eslint-disable-line no-empty-function
channel: {id: 'channel_id', display_name: 'channel_display_name'},
channelMember: {notify_props: {desktop: NotificationLevels.ALL}},
currentUser: {id: 'current_user_id', notify_props: {desktop: NotificationLevels.ALL}},
channelMember: {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required props.

notify_props: {
desktop: NotificationLevels.ALL,
mark_unread: NotificationLevels.ALL,
},
},
currentUser: {
id: 'current_user_id',
notify_props: {
desktop: NotificationLevels.ALL,
},
},
sendPushNotifications: true,
actions: {
updateChannelNotifyProps: () => {}, //eslint-disable-line no-empty-function
Expand Down Expand Up @@ -99,7 +109,12 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', ()
});

test('should match state on handleSubmitMarkUnreadLevel', () => {
const channelMember = {notify_props: {mark_unread: NotificationLevels.ALL}};
const channelMember = {
notify_props: {
desktop: NotificationLevels.NONE,
mark_unread: NotificationLevels.ALL,
},
};
const props = {...baseProps, channelMember};
const wrapper = shallow(
<ChannelNotificationsModal {...props}/>
Expand All @@ -120,7 +135,12 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', ()
});

test('should match state on handleUpdateMarkUnreadLevel', () => {
const channelMember = {notify_props: {mark_unread: NotificationLevels.ALL}};
const channelMember = {
notify_props: {
desktop: NotificationLevels.NONE,
mark_unread: NotificationLevels.ALL,
},
};
const props = {...baseProps, channelMember};
const wrapper = shallow(
<ChannelNotificationsModal {...props}/>
Expand All @@ -132,7 +152,12 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', ()
});

test('should match state on handleUpdateMarkUnreadSection', () => {
const channelMember = {notify_props: {mark_unread: NotificationLevels.ALL}};
const channelMember = {
notify_props: {
desktop: NotificationLevels.NONE,
mark_unread: NotificationLevels.ALL,
},
};
const props = {...baseProps, channelMember};
const wrapper = shallow(
<ChannelNotificationsModal {...props}/>
Expand All @@ -154,7 +179,13 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', ()
});

test('should match state on handleSubmitPushNotificationLevel', () => {
const channelMember = {notify_props: {push: NotificationLevels.ALL}};
const channelMember = {
notify_props: {
desktop: NotificationLevels.NONE,
mark_unread: NotificationLevels.NONE,
push: NotificationLevels.ALL,
},
};
const props = {...baseProps, channelMember};
const wrapper = shallow(
<ChannelNotificationsModal {...props}/>
Expand All @@ -175,7 +206,13 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', ()
});

test('should match state on handleUpdatePushNotificationLevel', () => {
const channelMember = {notify_props: {push: NotificationLevels.ALL}};
const channelMember = {
notify_props: {
desktop: NotificationLevels.NONE,
mark_unread: NotificationLevels.NONE,
push: NotificationLevels.ALL,
},
};
const props = {...baseProps, channelMember};
const wrapper = shallow(
<ChannelNotificationsModal {...props}/>
Expand All @@ -187,7 +224,14 @@ describe('components/channel_notifications_modal/ChannelNotificationsModal', ()
});

test('should match state on handleUpdatePushSection', () => {
const channelMember = {notify_props: {push: NotificationLevels.ALL}};
const channelMember = {
notify_props: {
desktop: NotificationLevels.NONE,
mark_unread: NotificationLevels.NONE,
push: NotificationLevels.ALL,
},
};

const props = {...baseProps, channelMember};
const wrapper = shallow(
<ChannelNotificationsModal {...props}/>
Expand Down
1 change: 1 addition & 0 deletions tests/components/create_comment/create_comment.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('components/CreateComment', () => {
const baseProps = {
channelId,
rootId,
rootDeleted: false,
channelMembersCount: 3,
draft: {
message: 'Test message',
Expand Down
3 changes: 3 additions & 0 deletions tests/components/dot_menu/dot_menu_empty.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('components/dot_menu/DotMenu returning empty ("")', () => {
setEditingPost: jest.fn(),
pinPost: jest.fn(),
unpinPost: jest.fn(),
openModal: jest.fn(),
},
};

Expand All @@ -52,6 +53,7 @@ describe('components/dot_menu/DotMenu returning empty ("")', () => {
setEditingPost: jest.fn(),
pinPost: jest.fn(),
unpinPost: jest.fn(),
openModal: jest.fn(),
},
};

Expand All @@ -72,6 +74,7 @@ describe('components/dot_menu/DotMenu returning empty ("")', () => {
setEditingPost: jest.fn(),
pinPost: jest.fn(),
unpinPost: jest.fn(),
openModal: jest.fn(),
},
};

Expand Down
1 change: 1 addition & 0 deletions tests/components/dot_menu/dot_menu_mobile.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('components/dot_menu/DotMenu on mobile view', () => {
setEditingPost: jest.fn(),
pinPost: jest.fn(),
unpinPost: jest.fn(),
openModal: jest.fn(),
},
};

Expand Down
5 changes: 5 additions & 0 deletions tests/components/navbar/navbar.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ describe('components/navbar/Navbar', () => {
isPinnedPosts: true,
actions: {
showEditChannelHeaderModal: jest.fn(),
toggleLhs: jest.fn(),
closeLhs: jest.fn(),
closeRhs: jest.fn(),
toggleRhsMenu: jest.fn(),
closeRhsMenu: jest.fn(),
},
isLicensed: true,
enableWebrtc: true,
Expand Down
2 changes: 2 additions & 0 deletions tests/components/sidebar/sidebar.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('component/sidebar/sidebar_channel/SidebarChannel', () => {
EnableXToLeaveChannelsFromLHS: 'false',
SiteName: 'Test site',
},
isOpen: false,
showUnreadSection: false,
publicChannelIds: ['c1', 'c2'],
privateChannelIds: ['c3', 'c4'],
Expand Down Expand Up @@ -108,6 +109,7 @@ describe('component/sidebar/sidebar_channel/SidebarChannel', () => {
},
actions: {
goToChannelById: jest.fn(),
close: jest.fn(),
},
};

Expand Down
1 change: 1 addition & 0 deletions tests/components/sidebar/sidebar_channel.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe('component/sidebar/sidebar_channel/SidebarChannel', () => {
offTopicDisplayName: 'Off-Topic',
membersCount: 8,
showUnreadForMsgs: true,
shouldHideChannel: false,
actions: {
savePreferences: jest.fn(),
leaveChannel: jest.fn(),
Expand Down