-
Notifications
You must be signed in to change notification settings - Fork 882
/
formActionsTest.js
81 lines (70 loc) · 1.98 KB
/
formActionsTest.js
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
73
74
75
76
77
78
79
80
81
import {
CLEAR_SOCIAL_IMAGE,
clearSocialPreviewImage,
SET_SOCIAL_DESCRIPTION,
SET_SOCIAL_IMAGE_TYPE,
SET_SOCIAL_IMAGE_URL,
SET_SOCIAL_TITLE,
setSocialPreviewDescription,
setSocialPreviewImage,
setSocialPreviewImageType,
setSocialPreviewImageUrl,
setSocialPreviewTitle,
} from "../../../src/redux/actions/formActions";
describe( setSocialPreviewTitle, () => {
it( "sets a title for facebook", () => {
const expected = {
type: SET_SOCIAL_TITLE,
platform: "facebook",
title: "A facebook title",
};
const actual = setSocialPreviewTitle( "A facebook title", "facebook" );
expect( actual ).toEqual( expected );
} );
} );
describe( setSocialPreviewDescription, () => {
it( "sets a description for facebook", () => {
const expected = {
type: SET_SOCIAL_DESCRIPTION,
platform: "facebook",
description: "This is a great descripton for my facebook post.",
};
const actual = setSocialPreviewDescription(
"This is a great descripton for my facebook post.",
"facebook",
);
expect( actual ).toEqual( expected );
} );
} );
describe( setSocialPreviewImage, () => {
it( "sets an image URL for facebook", () => {
const expected = {
type: SET_SOCIAL_IMAGE_URL,
platform: "facebook",
imageUrl: "https://yoast-image.png",
};
const actual = setSocialPreviewImageUrl( "https://yoast-image.png", "facebook" );
expect( actual ).toEqual( expected );
} );
} );
describe( setSocialPreviewImageType, () => {
it( "sets an image type for facebook", () => {
const expected = {
type: SET_SOCIAL_IMAGE_TYPE,
platform: "facebook",
imageType: "square",
};
const actual = setSocialPreviewImageType( "square", "facebook" );
expect( actual ).toEqual( expected );
} );
} );
describe( clearSocialPreviewImage, () => {
it( "removes an image for facebook (or twitter)", () => {
const expected = {
type: CLEAR_SOCIAL_IMAGE,
platform: "facebook",
};
const actual = clearSocialPreviewImage( "facebook" );
expect( actual ).toEqual( expected );
} );
} );