@@ -376,3 +376,49 @@ func TestExtractConceptIdsFromCustomConceptVariablesDef(t *testing.T) {
376
376
t .Errorf ("Expected %v but found %v" , expectedResult , result )
377
377
}
378
378
}
379
+
380
+ func TestCheckAndGetLastCustomConceptVariableDef (t * testing.T ) {
381
+ setUp (t )
382
+ testData := []interface {}{
383
+ utils.CustomDichotomousVariableDef {
384
+ CohortDefinitionId1 : 123 ,
385
+ CohortDefinitionId2 : 456 ,
386
+ ProvidedName : "test" ,
387
+ },
388
+ utils.CustomConceptVariableDef {
389
+ ConceptId : 1234 ,
390
+ },
391
+ }
392
+
393
+ result , err := utils .CheckAndGetLastCustomConceptVariableDef (testData )
394
+
395
+ if result == nil || err != nil {
396
+ t .Errorf ("Expected a valid result and no error. Result: %v, Error: %v" , result , err )
397
+ }
398
+
399
+ testData = []interface {}{
400
+ utils.CustomConceptVariableDef {
401
+ ConceptId : 1234 ,
402
+ },
403
+ utils.CustomDichotomousVariableDef {
404
+ CohortDefinitionId1 : 123 ,
405
+ CohortDefinitionId2 : 456 ,
406
+ ProvidedName : "test" ,
407
+ },
408
+ }
409
+
410
+ result , err = utils .CheckAndGetLastCustomConceptVariableDef (testData )
411
+
412
+ if result != nil || err == nil {
413
+ t .Errorf ("Expected NO result and an error. Result: %v, Error: %v" , result , err )
414
+ }
415
+
416
+ testData = []interface {}{}
417
+
418
+ result , err = utils .CheckAndGetLastCustomConceptVariableDef (testData )
419
+
420
+ if result != nil || err == nil {
421
+ t .Errorf ("Expected NO result and an error. Result: %v, Error: %v" , result , err )
422
+ }
423
+
424
+ }
0 commit comments