1 | import { expect } from 'chai';
|
2 | import sinon from 'sinon';
|
3 |
|
4 | import Actions from '../../data/actions';
|
5 |
|
6 | const actions = new Actions({});
|
7 |
|
8 | describe('data actions', () => {
|
9 |
|
10 | it('valid and invalid email addresses', () => {
|
11 | const dispatch = sinon.stub();
|
12 |
|
13 | const action = actions.validateThenSend();
|
14 | action(dispatch, () => ({ emailAddresses: ['b@b.com', 'ben@b.fletch', 'b@b', '@b.com', 'b@'] }));
|
15 |
|
16 | const result = dispatch.getCall(0).args.pop();
|
17 | expect(result).to.deep.equal({ type: 'VALIDATION_RESULTS', results: [false, false, false, true, true] });
|
18 | });
|
19 |
|
20 | });
|