Skip to content

Commit

Permalink
Improved code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexL committed Nov 24, 2017
1 parent a05b1dd commit b8b7eef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/validatePayload.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function validatePayload(validation, name, payload) {
}
} else /* typeof $validation === 'object' */ {
if (typeof payload !== 'object') {
return console.error('[REDUX-JEDI] Missing payload in action: ' + name, validation, payload)
throw Error('[REDUX-JEDI] Missing payload in action: ' + name, validation, payload)
}

const errors = Object.keys(validation)
Expand Down
5 changes: 5 additions & 0 deletions test/payloadValidation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,10 @@ function testPayloadValidation() {

assert.throws(() => reducer({}, { type: 'TEST', payload }))
})

it('should fail (because payload is missing)', () => {
const reducer = extractReducer(sample)
assert.throws(() => reducer({}, { type: 'TEST' }))
})
})
}

0 comments on commit b8b7eef

Please sign in to comment.