@@ -11,15 +11,14 @@ import {
1111 REQUIRED_MATCHER_PROVIDER ,
1212} from '@ng-dynamic-forms/core' ;
1313
14- import {
15- mockInputWithTypeBindModel , MockRelationModel
16- } from '../../../mocks/form-models.mock' ;
14+ import { mockInputWithTypeBindModel , MockRelationModel } from '../../../mocks/form-models.mock' ;
1715import { DsDynamicTypeBindRelationService } from './ds-dynamic-type-bind-relation.service' ;
1816import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model' ;
19- import { UntypedFormControl , ReactiveFormsModule } from '@angular/forms' ;
17+ import { ReactiveFormsModule , UntypedFormControl } from '@angular/forms' ;
2018import { FormBuilderService } from '../form-builder.service' ;
2119import { getMockFormBuilderService } from '../../../mocks/form-builder-service.mock' ;
2220import { Injector } from '@angular/core' ;
21+ import { VocabularyEntryDetail } from '../../../../core/submission/vocabularies/models/vocabulary-entry-detail.model' ;
2322
2423describe ( 'DSDynamicTypeBindRelationService test suite' , ( ) => {
2524 let service : DsDynamicTypeBindRelationService ;
@@ -42,17 +41,17 @@ describe('DSDynamicTypeBindRelationService test suite', () => {
4241 ( relationService : DsDynamicTypeBindRelationService ,
4342 formRelationService : DynamicFormRelationService ,
4443 ) => {
45- service = relationService ;
46- dynamicFormRelationService = formRelationService ;
47- } ) ) ;
44+ service = relationService ;
45+ dynamicFormRelationService = formRelationService ;
46+ } ) ) ;
4847
4948 describe ( 'Test getTypeBindValue method' , ( ) => {
5049 it ( 'Should get type bind "boundType" from the given metadata object value' , ( ) => {
51- const mockMetadataValueObject : FormFieldMetadataValueObject = new FormFieldMetadataValueObject (
52- 'boundType' , null , null , null , 'Bound Type'
53- ) ;
54- const bindType = service . getTypeBindValue ( mockMetadataValueObject ) ;
55- expect ( bindType ) . toBe ( 'boundType' ) ;
50+ const mockMetadataValueObject : FormFieldMetadataValueObject = new FormFieldMetadataValueObject (
51+ 'boundType' , null , null , null , 'Bound Type'
52+ ) ;
53+ const bindType = service . getTypeBindValue ( mockMetadataValueObject ) ;
54+ expect ( bindType ) . toBe ( 'boundType' ) ;
5655 } ) ;
5756 it ( 'Should get type authority key "bound-auth-key" from the given metadata object value' , ( ) => {
5857 const mockMetadataValueObject : FormFieldMetadataValueObject = new FormFieldMetadataValueObject (
@@ -61,6 +60,19 @@ describe('DSDynamicTypeBindRelationService test suite', () => {
6160 const bindType = service . getTypeBindValue ( mockMetadataValueObject ) ;
6261 expect ( bindType ) . toBe ( 'bound-auth-key' ) ;
6362 } ) ;
63+ it ( 'Should get type bind "boundType" from the given vocabulary entry object value' , ( ) => {
64+ const vocabularyEntry = new VocabularyEntryDetail ( ) ;
65+ vocabularyEntry . value = vocabularyEntry . display = 'boundType' ;
66+ const bindType = service . getTypeBindValue ( vocabularyEntry ) ;
67+ expect ( bindType ) . toBe ( 'boundType' ) ;
68+ } ) ;
69+ it ( 'Should get type authority key "bound-auth-key" from the given vocabulary entry object value' , ( ) => {
70+ const vocabularyEntry = new VocabularyEntryDetail ( ) ;
71+ vocabularyEntry . id = vocabularyEntry . authority = 'bound-auth-key' ;
72+ vocabularyEntry . value = vocabularyEntry . display = 'boundType' ;
73+ const bindType = service . getTypeBindValue ( vocabularyEntry ) ;
74+ expect ( bindType ) . toBe ( 'bound-auth-key' ) ;
75+ } ) ;
6476 it ( 'Should get passed string returned directly as string passed instead of metadata' , ( ) => {
6577 const bindType = service . getTypeBindValue ( 'rawString' ) ;
6678 expect ( bindType ) . toBe ( 'rawString' ) ;
0 commit comments