File size: 1,004 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import {
GRAVATAR_RECEIVE_IMAGE_FAILURE,
GRAVATAR_UPLOAD_REQUEST,
} from 'calypso/state/action-types';
import { receiveGravatarImageFailed, uploadGravatar } from '../actions';
const dispatch = jest.fn();
describe( 'actions', () => {
describe( '#uploadGravatar', () => {
test( 'dispatches request action with the file and email', () => {
const action = uploadGravatar( 'file', 'email' );
expect( action.type ).toEqual( GRAVATAR_UPLOAD_REQUEST );
expect( action.file ).toEqual( 'file' );
expect( action.email ).toEqual( 'email' );
} );
} );
describe( '#receiveGravatarImageFailed', () => {
test( 'dispatches image receive failure action with error message', () => {
const errorMessage = 'error';
const statName = 'statName';
receiveGravatarImageFailed( {
errorMessage,
statName,
} )( dispatch );
expect( dispatch ).toHaveBeenCalledWith( {
type: GRAVATAR_RECEIVE_IMAGE_FAILURE,
errorMessage,
meta: expect.any( Object ),
} );
} );
} );
} );
|