@@ -218,85 +218,108 @@ describe("ImportValidateSubscriptionDetailsService", () => {
218
218
} ) ;
219
219
220
220
describe ( "editable via internet" , ( ) => {
221
- it ( "sets entry status to invalid with SubscriptionDetailNotEditableError if subscription detail's VSSInternet is not 'E'" , async ( ) => {
221
+ it ( "sets entry status to valid without error if subscription detail's VSSInternet is 'E'" , async ( ) => {
222
222
mockSubscriptionDetail ( {
223
- VssInternet : "X " ,
223
+ VssInternet : "E " ,
224
224
} ) ;
225
- await expectsInvalidEntry ( SubscriptionDetailNotEditableError ) ;
225
+ await expectsValidEntry ( ) ;
226
226
} ) ;
227
227
228
- it ( "sets entry status to invalid with SubscriptionDetailNotEditableError if subscription detail's VssStyle is not 'TX '" , async ( ) => {
228
+ it ( "sets entry status to invalid with SubscriptionDetailNotEditableError if subscription detail's VSSInternet is not 'E '" , async ( ) => {
229
229
mockSubscriptionDetail ( {
230
- VssStyle : "X" ,
230
+ VssInternet : "X" ,
231
231
} ) ;
232
232
await expectsInvalidEntry ( SubscriptionDetailNotEditableError ) ;
233
233
} ) ;
234
234
} ) ;
235
235
236
236
describe ( "value type" , ( ) => {
237
- it ( "sets entry status to valid without error for int value Int type" , async ( ) => {
237
+ it ( "sets entry status to valid without error for int Int type with int value " , async ( ) => {
238
238
mockSubscriptionDetail ( {
239
239
VssTypeId : SubscriptionDetailType . Int ,
240
240
} ) ;
241
241
entry . value = 42 ;
242
242
await expectsValidEntry ( ) ;
243
243
} ) ;
244
244
245
- it ( "sets entry status to invalid with InvalidValueTypeError for string value Int type" , async ( ) => {
245
+ it ( "sets entry status to invalid with InvalidValueTypeError Int type with float value" , async ( ) => {
246
+ mockSubscriptionDetail ( {
247
+ VssTypeId : SubscriptionDetailType . Int ,
248
+ } ) ;
249
+ entry . value = 1.25 ;
250
+ await expectsInvalidEntry ( InvalidValueTypeError ) ;
251
+ } ) ;
252
+
253
+ it ( "sets entry status to invalid with InvalidValueTypeError for Int type with string value" , async ( ) => {
246
254
mockSubscriptionDetail ( {
247
255
VssTypeId : SubscriptionDetailType . Int ,
248
256
} ) ;
249
257
entry . value = "Lorem ipsum" ;
250
258
await expectsInvalidEntry ( InvalidValueTypeError ) ;
251
259
} ) ;
252
260
253
- it ( "sets entry status to valid without error for int value Currency type" , async ( ) => {
261
+ it ( "sets entry status to valid without error for Currency type with int value " , async ( ) => {
254
262
mockSubscriptionDetail ( {
255
263
VssTypeId : SubscriptionDetailType . Currency ,
256
264
} ) ;
257
265
entry . value = 42 ;
258
266
await expectsValidEntry ( ) ;
259
267
} ) ;
260
268
261
- it ( "sets entry status to invalid with InvalidValueTypeError for string value Currency type" , async ( ) => {
269
+ it ( "sets entry status to valid without error for Currency type with float value" , async ( ) => {
270
+ mockSubscriptionDetail ( {
271
+ VssTypeId : SubscriptionDetailType . Currency ,
272
+ } ) ;
273
+ entry . value = 1.25 ;
274
+ await expectsValidEntry ( ) ;
275
+ } ) ;
276
+
277
+ it ( "sets entry status to invalid with InvalidValueTypeError for Currency type with string value" , async ( ) => {
262
278
mockSubscriptionDetail ( {
263
279
VssTypeId : SubscriptionDetailType . Currency ,
264
280
} ) ;
265
281
entry . value = "Lorem ipsum" ;
266
282
await expectsInvalidEntry ( InvalidValueTypeError ) ;
267
283
} ) ;
268
284
269
- it ( "sets entry status to valid without error for string value Text type " , async ( ) => {
285
+ it ( "sets entry status to valid without error for ShortText type with string value " , async ( ) => {
270
286
mockSubscriptionDetail ( {
271
- VssTypeId : SubscriptionDetailType . Text ,
287
+ VssTypeId : SubscriptionDetailType . ShortText ,
272
288
} ) ;
273
289
entry . value = "Lorem ipsum" ;
274
290
await expectsValidEntry ( ) ;
275
291
} ) ;
276
292
277
- it ( "sets entry status to invalid with InvalidValueTypeError for number value Text type " , async ( ) => {
293
+ it ( "sets entry status to invalid with InvalidValueTypeError for ShortText type with number value " , async ( ) => {
278
294
mockSubscriptionDetail ( {
279
- VssTypeId : SubscriptionDetailType . Text ,
295
+ VssTypeId : SubscriptionDetailType . ShortText ,
280
296
} ) ;
281
297
entry . value = 42 ;
282
298
await expectsInvalidEntry ( InvalidValueTypeError ) ;
283
299
} ) ;
284
300
285
- it ( "sets entry status to valid without error for string value MemoText type " , async ( ) => {
301
+ it ( "sets entry status to valid without error for Text type with string value " , async ( ) => {
286
302
mockSubscriptionDetail ( {
287
- VssTypeId : SubscriptionDetailType . MemoText ,
303
+ VssTypeId : SubscriptionDetailType . Text ,
288
304
} ) ;
289
305
entry . value = "Lorem ipsum" ;
290
306
await expectsValidEntry ( ) ;
291
307
} ) ;
292
308
293
- it ( "sets entry status to invalid with InvalidValueTypeError for number value MemoText type " , async ( ) => {
309
+ it ( "sets entry status to invalid with InvalidValueTypeError for Text type with number value " , async ( ) => {
294
310
mockSubscriptionDetail ( {
295
- VssTypeId : SubscriptionDetailType . MemoText ,
311
+ VssTypeId : SubscriptionDetailType . Text ,
296
312
} ) ;
297
313
entry . value = 42 ;
298
314
await expectsInvalidEntry ( InvalidValueTypeError ) ;
299
315
} ) ;
316
+
317
+ it ( "sets entry status to invalid with InvalidValueTypeError for unsupported YesNo type" , async ( ) => {
318
+ mockSubscriptionDetail ( {
319
+ VssTypeId : 291 , // YesNo
320
+ } ) ;
321
+ await expectsInvalidEntry ( InvalidValueTypeError ) ;
322
+ } ) ;
300
323
} ) ;
301
324
302
325
describe ( "dropdown items" , ( ) => {
@@ -308,36 +331,36 @@ describe("ImportValidateSubscriptionDetailsService", () => {
308
331
await expectsValidEntry ( ) ;
309
332
} ) ;
310
333
311
- it ( "sets entry status to valid without error for supported dropdown item as number " , async ( ) => {
334
+ it ( "sets entry status to valid without error for existing dropdown item" , async ( ) => {
312
335
mockSubscriptionDetail ( {
313
336
DropdownItems : [
314
- { Key : 1 , Value : "Apple" } ,
315
- { Key : 2 , Value : "Pear" } ,
337
+ { Key : 1 , Value : "Apple" , IsActive : true } ,
338
+ { Key : 2 , Value : "Pear" , IsActive : true } ,
316
339
] ,
317
340
} ) ;
318
- entry . value = 1 ;
341
+ entry . value = "Apple" ;
319
342
await expectsValidEntry ( ) ;
320
343
} ) ;
321
344
322
- it ( "sets entry status to valid without error for supported dropdown item as string " , async ( ) => {
345
+ it ( "sets entry status to invalid with InvalidDropdownValueError for non-existing dropdown item" , async ( ) => {
323
346
mockSubscriptionDetail ( {
324
347
DropdownItems : [
325
- { Key : 1 , Value : "Apple" } ,
326
- { Key : 2 , Value : "Pear" } ,
348
+ { Key : 1 , Value : "Apple" , IsActive : true } ,
349
+ { Key : 2 , Value : "Pear" , IsActive : true } ,
327
350
] ,
328
351
} ) ;
329
- entry . value = "1 " ;
330
- await expectsValidEntry ( ) ;
352
+ entry . value = "Cherry " ;
353
+ await expectsInvalidEntry ( InvalidDropdownValueError ) ;
331
354
} ) ;
332
355
333
- it ( "sets entry status to invalid with InvalidDropdownValueError for unsupported dropdown item" , async ( ) => {
356
+ it ( "sets entry status to invalid with InvalidDropdownValueError for inactive dropdown item" , async ( ) => {
334
357
mockSubscriptionDetail ( {
335
358
DropdownItems : [
336
- { Key : 1 , Value : "Apple" } ,
337
- { Key : 2 , Value : "Pear" } ,
359
+ { Key : 1 , Value : "Apple" , IsActive : false } ,
360
+ { Key : 2 , Value : "Pear" , IsActive : true } ,
338
361
] ,
339
362
} ) ;
340
- entry . value = 3 ;
363
+ entry . value = "Apple" ;
341
364
await expectsInvalidEntry ( InvalidDropdownValueError ) ;
342
365
} ) ;
343
366
} ) ;
@@ -394,7 +417,7 @@ describe("ImportValidateSubscriptionDetailsService", () => {
394
417
detail . EventId = 10 ;
395
418
detail . IdPerson = 100 ;
396
419
detail . DropdownItems = value . DropdownItems ?? null ;
397
- detail . VssTypeId = value . VssTypeId ?? SubscriptionDetailType . Text ;
420
+ detail . VssTypeId = value . VssTypeId ?? SubscriptionDetailType . ShortText ;
398
421
detail . VssInternet = value . VssInternet ?? "E" ;
399
422
detail . VssStyle = value . VssStyle ?? "TX" ;
400
423
detail . Value = value . Value ?? "Lorem ipsum" ;
0 commit comments