File size: 1,797 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import {
	VIDEO_EDITOR_SET_POSTER_URL,
	VIDEO_EDITOR_SHOW_ERROR,
	VIDEO_EDITOR_SHOW_UPLOAD_PROGRESS,
	VIDEO_EDITOR_UPDATE_POSTER,
} from 'calypso/state/action-types';
import { setPosterUrl, showError, showUploadProgress, updatePoster } from '../actions';

describe( 'actions', () => {
	describe( '#updatePoster()', () => {
		test( 'should return an action object', () => {
			const videoId = 'dummy-videoId';
			const params = { atTime: 1 };
			const meta = { mediaId: 123456 };
			const action = updatePoster( videoId, params, meta );

			expect( action ).toEqual( {
				type: VIDEO_EDITOR_UPDATE_POSTER,
				videoId,
				params,
				meta,
			} );
		} );
	} );

	describe( '#setPosterUrl()', () => {
		test( 'should return an action object', () => {
			const poster = 'https://i1.wp.com/videos.files.wordpress.com/dummy-guid/thumbnail.jpg?ssl=1';
			const action = setPosterUrl( poster );

			expect( action ).toEqual( {
				type: VIDEO_EDITOR_SET_POSTER_URL,
				posterUrl: poster,
			} );
		} );
	} );

	describe( '#showError()', () => {
		test( 'should return an action object', () => {
			const action = showError();

			expect( action ).toEqual( {
				type: VIDEO_EDITOR_SHOW_ERROR,
			} );
		} );
	} );

	describe( '#showUploadProgress()', () => {
		test( 'should return an action object', () => {
			const percentage = 50;
			const action = showUploadProgress( percentage );

			expect( action ).toEqual( {
				type: VIDEO_EDITOR_SHOW_UPLOAD_PROGRESS,
				percentage,
			} );
		} );
	} );

	describe( '#updatePosterUploadProgress()', () => {
		test( 'should return an action object', () => {
			const percentage = 50;
			const action = showUploadProgress( percentage );

			expect( action ).toEqual( {
				type: VIDEO_EDITOR_SHOW_UPLOAD_PROGRESS,
				percentage,
			} );
		} );
	} );
} );