UNPKG

566 BJavaScriptView Raw
1import { expect } from 'chai';
2import sinon from 'sinon';
3
4import Actions from '../../data/actions';
5
6const actions = new Actions({});
7
8describe('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});