-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Eliminate yarn test spam #1024
Eliminate yarn test spam #1024
Changes from 8 commits
3604978
d548f3d
c99562f
73b5fcb
b331b43
9a49fde
dc6d2a4
b7c99d9
ab47e5b
688c6b8
7642e80
e480ec1
b209749
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,12 +76,12 @@ export default class Sidebar extends React.PureComponent { | |
/** | ||
* Current team object | ||
*/ | ||
currentTeam: PropTypes.object.isRequired, | ||
currentTeam: PropTypes.object, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,7 @@ | |
"image-webpack-loader": "3.6.0", | ||
"imports-loader": "0.7.1", | ||
"jest": "22.1.4", | ||
"jest-canvas-mock": "1.0.2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So that the doughtnut chart doesn't throw errors about |
||
"jest-cli": "22.1.4", | ||
"jquery-deferred": "0.3.1", | ||
"json-loader": "0.5.7", | ||
|
@@ -141,6 +142,7 @@ | |
"transformIgnorePatterns": [ | ||
"node_modules/(?!react-native|react-router)" | ||
], | ||
"setupFiles": ["jest-canvas-mock"], | ||
"setupTestFrameworkScriptFile": "<rootDir>/tests/setup.js", | ||
"testURL": "http:https://localhost:8065" | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,7 @@ export default function configureStore(initialState) { | |
const storage = localforage; | ||
const KEY_PREFIX = 'reduxPersist:'; | ||
|
||
localforage.ready(() => { | ||
localforage.ready().then(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See localForage/localForage#722 for more details. |
||
const persistor = persistStore(store, {storage, keyPrefix: KEY_PREFIX, ...options}, () => { | ||
store.dispatch({ | ||
type: General.STORE_REHYDRATION_COMPLETE, | ||
|
@@ -135,6 +135,11 @@ export default function configureStore(initialState) { | |
}); | ||
} | ||
}); | ||
}).catch((error) => { | ||
store.dispatch({ | ||
type: General.STORE_REHYDRATION_FAILED, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've got a pending PR to add this constant to mattermost-redux... if we think we need it. No one is going to handle it right now. Feedback requested! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if I prefer simply a log message for now. Anyway, I think it must be in the webapp redux flow, not in the mattermost-redux one. Because all the storage thing is handle independently from RN app and webapp. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll move the constant locally -- the log message would defeat the point of this change, at present ;P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hahaha, you are completely right, I'm an idiot :) |
||
error, | ||
}); | ||
}); | ||
}, | ||
persistOptions: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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}/> | ||
|
@@ -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}/> | ||
|
@@ -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}/> | ||
|
@@ -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}/> | ||
|
@@ -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}/> | ||
|
@@ -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}/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,15 @@ Object.defineProperty(document, 'queryCommandSupported', { | |
Object.defineProperty(document, 'execCommand', { | ||
value: (cmd) => supportedCommands.includes(cmd), | ||
}); | ||
|
||
beforeEach(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't let this regress in the future. |
||
console.log = jest.fn((error) => { | ||
throw new Error('Unexpected console log: ' + error); | ||
}); | ||
console.warn = jest.fn((error) => { | ||
throw new Error('Unexpected console warning: ' + error); | ||
}); | ||
console.error = jest.fn((error) => { | ||
throw new Error('Unexpected console error: ' + error); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ const MIN_NETWORK_RETRY_TIME = 3000; // 3 sec | |
const MAX_NETWORK_RETRY_TIME = 300000; // 5 mins | ||
|
||
function handle(callback, online) { | ||
console.log('Network status set to ' + online); //eslint-disable-line no-console | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked with author: no longer needed. |
||
if (window.requestAnimationFrame) { | ||
window.requestAnimationFrame(() => callback(online)); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,6 @@ export function getPrefix(state) { | |
} | ||
} | ||
|
||
console.warn('Storage tried to operate without user present'); //eslint-disable-line no-console | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked with author: no longer needed. |
||
|
||
return 'unknown_'; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4978,6 +4978,10 @@ [email protected]: | |
version "3.1.3" | ||
resolved "https://registry.yarnpkg.com/jasny-bootstrap/-/jasny-bootstrap-3.1.3.tgz#b072a681d50c649762c9543c7a6093d9baa2f87b" | ||
|
||
[email protected]: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/jest-canvas-mock/-/jest-canvas-mock-1.0.2.tgz#05373f8f87fa764ca25fb4c5d6d9e34954a05550" | ||
|
||
jest-changed-files@^22.1.4: | ||
version "22.1.4" | ||
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-22.1.4.tgz#1f7844bcb739dec07e5899a633c0cb6d5069834e" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Injected by the connector but wasn't removed, like
enableWebrtc
, and ended up incorrectly as a DOM property.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are not using showEmailAddress at all, so, the solution would be remove that from the connect function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh, I like that better -- somehow, I thought this was being passed in via a plugin, but you're right that it's only part of the pluggable unit tests.