Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bartonhammond committed Jan 24, 2016
1 parent 3fb493b commit e6d4f6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/__mocks__/react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ReactNative.View = View;
ReactNative.ScrollView = View;
ReactNative.Text = View;
ReactNative.TouchableOpacity = View;
ReactNative.TouchableHighlight = View;
ReactNative.TouchableWithoutFeedback = View;
ReactNative.ToolbarAndroid = View;
ReactNative.Image = View;
Expand Down
10 changes: 2 additions & 8 deletions src/components/ErrorAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,12 @@ var ErrorAlert = class ErrorAlertClass{
* ## ErrorAlert
* setup to support testing
*/
constructor(alerter) {
this.alerter = alerter;
}
/**
* ### checkErro
* determine if there is an error and how deep it is. Take the
* deepest level as the message and display it
*/
checkError(obj) {
if (!this.alerter) {
this.alerter = SimpleAlert;
}
let errorMessage = '';
if (!_.isNull(obj)) {
if (!_.isUndefined(obj.error)) {
Expand All @@ -46,9 +40,9 @@ var ErrorAlert = class ErrorAlertClass{
}
if (errorMessage !== '') {
if (!_.isUndefined(errorMessage.message)) {
this.alerter.alert('Error',errorMessage.message);
SimpleAlert.alert('Error',errorMessage.message);
} else {
this.alerter.alert('Error',errorMessage);
SimpleAlert.alert('Error',errorMessage);
}
}
}//isNull
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/ErrorAlert-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('ErrorAlert', () => {
* check that the title is 'Error' which is a hard coded constant
* and the alert matches the props error
*/
new ErrorAlert(SimpleAlert).checkError(errorAlertProps);
new ErrorAlert().checkError(errorAlertProps);
expect(SimpleAlert.alert.mock.calls[0][0]).toEqual('Error');
expect(SimpleAlert.alert.mock.calls[0][1]).toEqual(errorAlertProps.error.error);
});
Expand Down

0 comments on commit e6d4f6d

Please sign in to comment.