@@ -47,6 +47,26 @@ describe('PaddleIntegration', () => {
47
47
expect ( status . quantity ) . to . equal ( createPayload . quantity )
48
48
expect ( status . start_at ) . to . equal ( createPayload . event_time )
49
49
} )
50
+ it ( 'throws if identifier is falsy' , ( ) => {
51
+ return paddleIntegration . addSubscription ( null , 'not-null' ) . then ( ( ) => {
52
+ return Promise . reject ( 'Must throw an error' )
53
+ } , ( error ) => {
54
+ console . log ( error . message )
55
+ if ( error . message !== 'INVALID_ARGUMENTS' ) {
56
+ return Promise . reject ( 'Must throw an error "INVALID_ARGUMENTS' )
57
+ }
58
+ } )
59
+ } )
60
+ it ( 'throws if subscription is falsy' , ( ) => {
61
+ return paddleIntegration . addSubscription ( 'not-null' , null ) . then ( ( ) => {
62
+ return Promise . reject ( 'Must throw an error' )
63
+ } , ( error ) => {
64
+ console . log ( error . message )
65
+ if ( error . message !== 'INVALID_ARGUMENTS' ) {
66
+ return Promise . reject ( 'Must throw an error "INVALID_ARGUMENTS' )
67
+ }
68
+ } )
69
+ } )
50
70
} )
51
71
52
72
describe ( '.updateSubscription' , ( ) => {
@@ -107,6 +127,16 @@ describe('PaddleIntegration', () => {
107
127
expect ( status2 . quantity ) . to . equal ( updatePayload . new_quantity )
108
128
expect ( status2 . start_at ) . to . equal ( updatePayload . event_time )
109
129
} )
130
+ it ( 'throws if subscription is falsy' , ( ) => {
131
+ return paddleIntegration . updateSubscription ( null ) . then ( ( ) => {
132
+ return Promise . reject ( 'Must throw an error' )
133
+ } , ( error ) => {
134
+ console . log ( error . message )
135
+ if ( error . message !== 'INVALID_ARGUMENTS' ) {
136
+ return Promise . reject ( 'Must throw an error "INVALID_ARGUMENTS' )
137
+ }
138
+ } )
139
+ } )
110
140
} )
111
141
112
142
describe ( '.cancelSubscription' , ( ) => {
@@ -153,6 +183,15 @@ describe('PaddleIntegration', () => {
153
183
expect ( status . quantity ) . to . equal ( cancelPayload . quantity )
154
184
expect ( status . start_at ) . to . equal ( cancelPayload . cancellation_effective_date )
155
185
} )
186
+ it ( 'throws if subscription is falsy' , ( ) => {
187
+ return paddleIntegration . cancelSubscription ( null ) . then ( ( ) => {
188
+ return Promise . reject ( 'Must throw an error' )
189
+ } , ( error ) => {
190
+ if ( error . message !== 'INVALID_ARGUMENTS' ) {
191
+ return Promise . reject ( 'Must throw an error "INVALID_ARGUMENTS' )
192
+ }
193
+ } )
194
+ } )
156
195
} )
157
196
158
197
describe ( '.hasActiveSubscription' , ( ) => {
0 commit comments