@@ -64,7 +64,8 @@ describe('VocabularyTreeviewService test suite', () => {
6464 searchTopEntries : jasmine . createSpy ( 'searchTopEntries' ) ,
6565 getEntryDetailChildren : jasmine . createSpy ( 'getEntryDetailChildren' ) ,
6666 clearSearchTopRequests : jasmine . createSpy ( 'clearSearchTopRequests' ) ,
67- getPublicVocabularyEntryByValue : jasmine . createSpy ( 'getPublicVocabularyEntryByValue' )
67+ getPublicVocabularyEntryByValue : jasmine . createSpy ( 'getPublicVocabularyEntryByValue' ) ,
68+ getPublicVocabularyEntryByID : jasmine . createSpy ( 'getPublicVocabularyEntryByID' ) ,
6869 } ) ;
6970
7071 function init ( ) {
@@ -204,46 +205,52 @@ describe('VocabularyTreeviewService test suite', () => {
204205 } ) ;
205206
206207 it ( 'should set initValueHierarchy' , ( ) => {
207- serviceAsAny . vocabularyService . searchTopEntries . and . returnValue ( hot ( '--a' , {
208- a : createSuccessfulRemoteDataObject ( buildPaginatedList ( pageInfo , [ item , item2 , item3 ] ) )
208+ serviceAsAny . vocabularyService . getEntryDetailChildren . and . returnValue ( hot ( '--a' , {
209+ a : createSuccessfulRemoteDataObject ( buildPaginatedList ( pageInfo , [ child , child2 ] ) )
209210 } ) ) ;
210- serviceAsAny . vocabularyService . findEntryDetailById . and . returnValue (
211+ serviceAsAny . vocabularyService . findEntryDetailById . and . returnValues (
211212 hot ( '-a' , {
212- a : createSuccessfulRemoteDataObject ( child2 )
213+ a : createSuccessfulRemoteDataObject ( child ) ,
214+ } ) ,
215+ hot ( '-b' , {
216+ b : createSuccessfulRemoteDataObject ( item )
213217 } )
214218 ) ;
215219 serviceAsAny . vocabularyService . getEntryDetailParent . and . returnValue (
216220 hot ( '-b' , {
217221 b : createSuccessfulRemoteDataObject ( item )
218222 } )
219223 ) ;
220- scheduler . schedule ( ( ) => service . initialize ( vocabularyOptions , pageInfo , [ ] , 'root2' ) ) ;
224+
225+ scheduler . schedule ( ( ) => service . initialize ( vocabularyOptions , pageInfo , [ ] , 'root1' ) ) ;
221226 scheduler . flush ( ) ;
222227
223228 expect ( serviceAsAny . vocabularyName ) . toEqual ( vocabularyOptions . name ) ;
224- expect ( serviceAsAny . initValueHierarchy ) . toEqual ( [ 'root1' , 'root1-child2' ] ) ;
225- expect ( serviceAsAny . dataChange . value ) . toEqual ( [ itemInitNode , itemNode2 , itemNode3 ] ) ;
229+ expect ( serviceAsAny . initValueHierarchy ) . toEqual ( [ 'root1' , 'root1-child1' ] ) ;
226230 } ) ;
227-
228- it ( 'should show only nodes restricted to init Value Hierarchy' , ( ) => {
229- serviceAsAny . vocabularyService . searchTopEntries . and . returnValue ( hot ( '--a' , {
230- a : createSuccessfulRemoteDataObject ( buildPaginatedList ( pageInfo , [ item , item2 , item3 ] ) )
231+ // Disabled as we don't limt the tree anymore to the first value of the hierarchy but we start building the tree directly from that one (root node) for any case
232+ xit ( 'should show only nodes restricted to init Value Hierarchy' , ( ) => {
233+ serviceAsAny . vocabularyService . getEntryDetailChildren . and . returnValue ( hot ( '--a' , {
234+ a : createSuccessfulRemoteDataObject ( buildPaginatedList ( pageInfo , [ child , child2 ] ) )
231235 } ) ) ;
232- serviceAsAny . vocabularyService . findEntryDetailById . and . returnValue (
236+ serviceAsAny . vocabularyService . findEntryDetailById . and . returnValues (
233237 hot ( '-a' , {
234- a : createSuccessfulRemoteDataObject ( child2 )
238+ a : createSuccessfulRemoteDataObject ( child ) ,
239+ } ) ,
240+ hot ( '-b' , {
241+ b : createSuccessfulRemoteDataObject ( item )
235242 } )
236243 ) ;
237244 serviceAsAny . vocabularyService . getEntryDetailParent . and . returnValue (
238245 hot ( '-b' , {
239246 b : createSuccessfulRemoteDataObject ( item )
240247 } )
241248 ) ;
242- scheduler . schedule ( ( ) => service . initialize ( vocabularyOptions , pageInfo , [ 'root2 ' ] , 'root2 ' , true ) ) ;
249+ scheduler . schedule ( ( ) => service . initialize ( vocabularyOptions , pageInfo , [ 'root1-child1 ' ] , 'root1-child1 ' , true ) ) ;
243250 scheduler . flush ( ) ;
244251
245252 expect ( serviceAsAny . vocabularyName ) . toEqual ( vocabularyOptions . name ) ;
246- expect ( serviceAsAny . initValueHierarchy ) . toEqual ( [ 'root1' , 'root1-child2 ' ] ) ;
253+ expect ( serviceAsAny . initValueHierarchy ) . toEqual ( [ 'root1' , 'root1-child1 ' ] ) ;
247254 expect ( serviceAsAny . dataChange . value ) . toEqual ( [ itemInitNode ] ) ;
248255 } ) ;
249256 } ) ;
0 commit comments