@@ -7,7 +7,7 @@ describe('DisjointSetItem', () => {
77 const itemC = new DisjointSetItem ( 'C' ) ;
88 const itemD = new DisjointSetItem ( 'D' ) ;
99
10- expect ( itemA . getAncestorsCount ( ) ) . toBe ( 0 ) ;
10+ expect ( itemA . getRank ( ) ) . toBe ( 0 ) ;
1111 expect ( itemA . getChildren ( ) ) . toEqual ( [ ] ) ;
1212 expect ( itemA . getKey ( ) ) . toBe ( 'A' ) ;
1313 expect ( itemA . getRoot ( ) ) . toEqual ( itemA ) ;
@@ -17,11 +17,11 @@ describe('DisjointSetItem', () => {
1717 itemA . addChild ( itemB ) ;
1818 itemD . setParent ( itemC ) ;
1919
20- expect ( itemA . getAncestorsCount ( ) ) . toBe ( 1 ) ;
21- expect ( itemC . getAncestorsCount ( ) ) . toBe ( 1 ) ;
20+ expect ( itemA . getRank ( ) ) . toBe ( 1 ) ;
21+ expect ( itemC . getRank ( ) ) . toBe ( 1 ) ;
2222
23- expect ( itemB . getAncestorsCount ( ) ) . toBe ( 0 ) ;
24- expect ( itemD . getAncestorsCount ( ) ) . toBe ( 0 ) ;
23+ expect ( itemB . getRank ( ) ) . toBe ( 0 ) ;
24+ expect ( itemD . getRank ( ) ) . toBe ( 0 ) ;
2525
2626 expect ( itemA . getChildren ( ) . length ) . toBe ( 1 ) ;
2727 expect ( itemC . getChildren ( ) . length ) . toBe ( 1 ) ;
@@ -50,9 +50,9 @@ describe('DisjointSetItem', () => {
5050 expect ( itemC . isRoot ( ) ) . toBeFalsy ( ) ;
5151 expect ( itemD . isRoot ( ) ) . toBeFalsy ( ) ;
5252
53- expect ( itemA . getAncestorsCount ( ) ) . toEqual ( 3 ) ;
54- expect ( itemB . getAncestorsCount ( ) ) . toEqual ( 0 ) ;
55- expect ( itemC . getAncestorsCount ( ) ) . toEqual ( 1 ) ;
53+ expect ( itemA . getRank ( ) ) . toEqual ( 3 ) ;
54+ expect ( itemB . getRank ( ) ) . toEqual ( 0 ) ;
55+ expect ( itemC . getRank ( ) ) . toEqual ( 1 ) ;
5656 } ) ;
5757
5858 it ( 'should do basic manipulation with disjoint set item with custom key extractor' , ( ) => {
@@ -65,7 +65,7 @@ describe('DisjointSetItem', () => {
6565 const itemC = new DisjointSetItem ( { key : 'C' , value : 3 } , keyExtractor ) ;
6666 const itemD = new DisjointSetItem ( { key : 'D' , value : 4 } , keyExtractor ) ;
6767
68- expect ( itemA . getAncestorsCount ( ) ) . toBe ( 0 ) ;
68+ expect ( itemA . getRank ( ) ) . toBe ( 0 ) ;
6969 expect ( itemA . getChildren ( ) ) . toEqual ( [ ] ) ;
7070 expect ( itemA . getKey ( ) ) . toBe ( 'A' ) ;
7171 expect ( itemA . getRoot ( ) ) . toEqual ( itemA ) ;
@@ -75,11 +75,11 @@ describe('DisjointSetItem', () => {
7575 itemA . addChild ( itemB ) ;
7676 itemD . setParent ( itemC ) ;
7777
78- expect ( itemA . getAncestorsCount ( ) ) . toBe ( 1 ) ;
79- expect ( itemC . getAncestorsCount ( ) ) . toBe ( 1 ) ;
78+ expect ( itemA . getRank ( ) ) . toBe ( 1 ) ;
79+ expect ( itemC . getRank ( ) ) . toBe ( 1 ) ;
8080
81- expect ( itemB . getAncestorsCount ( ) ) . toBe ( 0 ) ;
82- expect ( itemD . getAncestorsCount ( ) ) . toBe ( 0 ) ;
81+ expect ( itemB . getRank ( ) ) . toBe ( 0 ) ;
82+ expect ( itemD . getRank ( ) ) . toBe ( 0 ) ;
8383
8484 expect ( itemA . getChildren ( ) . length ) . toBe ( 1 ) ;
8585 expect ( itemC . getChildren ( ) . length ) . toBe ( 1 ) ;
@@ -108,8 +108,8 @@ describe('DisjointSetItem', () => {
108108 expect ( itemC . isRoot ( ) ) . toBeFalsy ( ) ;
109109 expect ( itemD . isRoot ( ) ) . toBeFalsy ( ) ;
110110
111- expect ( itemA . getAncestorsCount ( ) ) . toEqual ( 3 ) ;
112- expect ( itemB . getAncestorsCount ( ) ) . toEqual ( 0 ) ;
113- expect ( itemC . getAncestorsCount ( ) ) . toEqual ( 1 ) ;
111+ expect ( itemA . getRank ( ) ) . toEqual ( 3 ) ;
112+ expect ( itemB . getRank ( ) ) . toEqual ( 0 ) ;
113+ expect ( itemC . getRank ( ) ) . toEqual ( 1 ) ;
114114 } ) ;
115115} ) ;
0 commit comments