Skip to content

Instantly share code, notes, and snippets.

@raine
Last active October 8, 2015 20:55
Show Gist options
  • Save raine/d14dc3d8010274dc640a to your computer and use it in GitHub Desktop.
Save raine/d14dc3d8010274dc640a to your computer and use it in GitHub Desktop.
const assertRejectedWith = (p, fn) =>
Promise.all([
assert.isRejected(p),
p.catch(fn)
]);
const assertRejectedWithMsg = (p, str) =>
assertRejectedWith(p, err => assert.deepEqual(err.message, str))
it('throws if body can\'t be found for the email type', () => {
const payload = assoc('type', 'this-type-does-not-exist', PAYLOAD);
return assertRejectedWithMsg(
testDispatch(defaultTmpls, payload),
'Body not found (type=this-type-does-not-exist, lang=en, format=html)'
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment