Skip to content

Commit 948cbf2

Browse files
Joakim Reinerttimche
authored andcommitted
add test for meta in error actions (#64)
1 parent b0ff044 commit 948cbf2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/__tests__/createAction-test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,18 @@ describe('createAction()', () => {
6767
});
6868
expect(isFSA(noErrAction)).to.be.true;
6969
});
70+
71+
it('sets error to true if payload is an Error object and meta is provided', () => {
72+
const actionCreator = createAction(type, null, (_, meta) => meta);
73+
const errObj = new TypeError('this is an error');
74+
75+
const errAction = actionCreator(errObj, { foo: 'bar' });
76+
expect(errAction).to.deep.equal({
77+
type,
78+
payload: errObj,
79+
error: true,
80+
meta: { foo: 'bar' }
81+
});
82+
});
7083
});
7184
});

0 commit comments

Comments
 (0)