File size: 830 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
import { forEach } from 'lodash';
import { ANALYTICS_STAT_BUMP } from 'calypso/state/action-types';
import { setMediaModalView } from 'calypso/state/ui/media-modal/actions';
import { MODAL_VIEW_STATS, setEditorMediaModalView } from '../actions';

describe( 'actions', () => {
	describe( 'setEditorMediaModalView()', () => {
		test( 'should dispatch setMediaModalView with analytics', () => {
			expect.assertions( Object.entries( MODAL_VIEW_STATS ).length );
			forEach( MODAL_VIEW_STATS, ( stat, view ) => {
				expect( setEditorMediaModalView( view ) ).toEqual( {
					...setMediaModalView( view ),
					meta: {
						analytics: [
							{
								type: ANALYTICS_STAT_BUMP,
								payload: {
									group: 'editor_media_actions',
									name: stat,
								},
							},
						],
					},
				} );
			} );
		} );
	} );
} );