@@ -7,7 +7,7 @@ it('getInvoices should create GET_INVOICES action', () => {
7
7
} ) ;
8
8
} ) ;
9
9
10
- it ( 'saveInvoice should create SAVE_INVOICE action' , ( ) => {
10
+ it ( 'saveInvoice should create INVOICE_SAVE action' , ( ) => {
11
11
const invoiceData = {
12
12
_id : 'jon_snow' ,
13
13
fulname : 'Jon Snow' ,
@@ -19,21 +19,73 @@ it('saveInvoice should create SAVE_INVOICE action', () => {
19
19
} ) ;
20
20
} ) ;
21
21
22
- it ( 'deleteInvoice should create DELETE_INVOICE action' , ( ) => {
22
+ it ( 'newInvoiceFromContact should create INVOICE_NEW_FROM_CONTACT action' , ( ) => {
23
+ const contactData = {
24
+ _id : 'jon_snow' ,
25
+ fulname : 'Jon Snow' ,
26
+
27
+ } ;
28
+ expect ( actions . newInvoiceFromContact ( contactData ) ) . toEqual ( {
29
+ type : ACTION_TYPES . INVOICE_NEW_FROM_CONTACT ,
30
+ payload : contactData ,
31
+ } ) ;
32
+ } ) ;
33
+
34
+ it ( 'deleteInvoice should create INVOICE_DELETE action' , ( ) => {
23
35
expect ( actions . deleteInvoice ( 'jon_snow' ) ) . toEqual ( {
24
36
type : ACTION_TYPES . INVOICE_DELETE ,
25
37
payload : 'jon_snow' ,
26
38
} ) ;
27
39
} ) ;
28
40
29
- it ( 'newInvoiceFromContact should create INVOICE_NEW_FROM_CONTACT action' , ( ) => {
30
- const contact = {
31
- id : 'abcxyz ' ,
32
- name : 'Jon Snow' ,
33
- company : 'HBO ' ,
41
+ it ( 'editInvoice should create INVOICE_EDIT action' , ( ) => {
42
+ const invoiceData = {
43
+ _id : 'jon_snow ' ,
44
+ fulname : 'Jon Snow' ,
45
+
34
46
} ;
35
- expect ( actions . newInvoiceFromContact ( contact ) ) . toEqual ( {
36
- type : ACTION_TYPES . INVOICE_NEW_FROM_CONTACT ,
37
- payload : contact ,
47
+ expect ( actions . editInvoice ( invoiceData ) ) . toEqual ( {
48
+ type : ACTION_TYPES . INVOICE_EDIT ,
49
+ payload : invoiceData ,
50
+ } ) ;
51
+ } ) ;
52
+
53
+ it ( 'updateInvoice should create INVOICE_UPDATE action' , ( ) => {
54
+ const invoiceData = {
55
+ _id : 'jon_snow' ,
56
+ fulname : 'Jon Snow' ,
57
+
58
+ } ;
59
+ expect ( actions . updateInvoice ( invoiceData ) ) . toEqual ( {
60
+ type : ACTION_TYPES . INVOICE_UPDATE ,
61
+ payload : invoiceData ,
62
+ } ) ;
63
+ } ) ;
64
+
65
+ it ( 'setInvoiceStatus should create INVOICE_SET_STATUS action' , ( ) => {
66
+ const invoiceID = 'jon_snow' ;
67
+ const status = 'pending' ;
68
+ expect ( actions . setInvoiceStatus ( invoiceID , status ) ) . toEqual ( {
69
+ type : ACTION_TYPES . INVOICE_SET_STATUS ,
70
+ payload : {
71
+ invoiceID : 'jon_snow' ,
72
+ status : 'pending' ,
73
+ } ,
74
+ } ) ;
75
+ } ) ;
76
+
77
+ it ( 'saveInvoiceConfigs should create INVOICE_CONFIGS_SAVE action' , ( ) => {
78
+ const invoiceID = 'jon_snow' ;
79
+ const configs = {
80
+ color : 'red'
81
+ } ;
82
+ expect ( actions . saveInvoiceConfigs ( invoiceID , configs ) ) . toEqual ( {
83
+ type : ACTION_TYPES . INVOICE_CONFIGS_SAVE ,
84
+ payload : {
85
+ invoiceID : 'jon_snow' ,
86
+ configs : {
87
+ color : 'red'
88
+ }
89
+ }
38
90
} ) ;
39
91
} ) ;
0 commit comments