Commit a01bb4f5 authored by Rik Smith-Unna's avatar Rik Smith-Unna
Browse files

Give much better errors in mismatched type

parent 499b9d33
......@@ -85,8 +85,12 @@ const describeAction = actions => (key, opts, cb) => {
)
expect(dispatched).to.be.ok
expect(dispatched.type).to.equal(opts.types.request)
expect(
dispatched.type
).to.equal(
opts.types.request,
`Received dispatched object with wrong type: \n${JSON.stringify(dispatched, null, 2)}`
)
if (properties) {
expect(Object.keys(dispatched)).to.include.members(properties)
}
......@@ -112,7 +116,12 @@ const describeAction = actions => (key, opts, cb) => {
).then(
dispatched => {
expect(dispatched).to.be.ok
expect(dispatched.type).to.equal(opts.types.success)
expect(
dispatched.type
).to.equal(
opts.types.success,
`Received dispatched object with wrong type: \n${JSON.stringify(dispatched, null, 2)}`
)
if (properties) {
expect(Object.keys(dispatched)).to.include.members(properties)
}
......@@ -139,7 +148,12 @@ const describeAction = actions => (key, opts, cb) => {
).then(
dispatched => {
expect(dispatched).to.be.ok
expect(dispatched.type).to.equal(opts.types.failure)
expect(
dispatched.type
).to.equal(
opts.types.failure,
`Received dispatched object with wrong type: \n${JSON.stringify(dispatched, null, 2)}`
)
if (properties) {
expect(Object.keys(dispatched)).to.include.members(properties)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment