Skip to content

Commit

Permalink
Merge pull request #8 from mattsmee/code-climate
Browse files Browse the repository at this point in the history
make code climate happier
  • Loading branch information
scull7 committed Jul 28, 2016
2 parents 350054f + b0ebbde commit dba5f39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions lib/human.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,21 @@ const formattedUserInput = (spec, result, custom) => {
// formattedIncorrectInput
// :: ( Spec, PropCheckResult, CustomMessage ) -> String
const formattedIncorrectInput = (spec, result, custom) => {
return _.compose (
getErrorMessage(' ' + errorMessage(custom).unexpected + '\n\n ')
, getPseudoObjectString
, _.difference
)(_.keys(result), _.keys(spec));
return formatMessage(result, spec, errorMessage(custom).unexpected);
};


// formattedExpectedInput
// :: ( Spec, PropCheckResult, CustomMessage ) -> String
const formattedExpectedInput = (spec, result, custom) => {
return formatMessage(spec, result, errorMessage(custom).missing);
};


// formatMessage :: ( Spec, PropCheckResult, String ) -> String
const formatMessage = (spec, result, error_message) => {
return _.compose (
getErrorMessage(' ' + errorMessage(custom).missing + '\n\n ')
getErrorMessage(' ' + error_message + '\n\n ')
, getPseudoObjectString
, _.difference
)(_.keys(spec), _.keys(result));
Expand Down
2 changes: 1 addition & 1 deletion test/lib/human.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('props-check/lib/human.js', () => {

const actual3 = human(spec, PropCheck(spec, bad_test3), null);
expect(actual3).to.be.a('String');

console.log(actual1);
});

});

0 comments on commit dba5f39

Please sign in to comment.