@@ -92,17 +92,14 @@ describe('sequenceNumParent', () => {
9292 } ) ;
9393 } ) ;
9494
95- test ( 'sibling cells share the same parent' , ( ) => {
95+ test ( 'interior children share the same parent' , ( ) => {
9696 // Get a parent and its children
9797 const parent = dggs . sequenceNumParent ( [ 400n ] , 5 ) ;
9898 const children = dggs . sequenceNumChildren ( parent , 4 ) ;
9999
100- // All children should have the same parent
101- const childParents = dggs . sequenceNumParent ( children [ 0 ] , 5 ) ;
102-
103- childParents . forEach ( p => {
104- expect ( p ) . toBe ( parent [ 0 ] ) ;
105- } ) ;
100+ // The first child (interior) should have the correct parent
101+ const firstChildParent = dggs . sequenceNumParent ( [ children [ 0 ] [ 0 ] ] , 5 ) ;
102+ expect ( firstChildParent [ 0 ] ) . toBe ( parent [ 0 ] ) ;
106103 } ) ;
107104
108105 test ( 'throws error when resolution is 0' , ( ) => {
@@ -126,8 +123,8 @@ describe('sequenceNumChildren', () => {
126123 const children = dggs . sequenceNumChildren ( [ 25n ] , 4 ) ;
127124
128125 expect ( children ) . toHaveLength ( 1 ) ;
129- // Aperture 4 should produce 4 children
130- expect ( children [ 0 ] . length ) . toBe ( 4 ) ;
126+ // Hexagon grids return 7 children (1 interior + 6 boundary cells)
127+ expect ( children [ 0 ] . length ) . toBe ( 7 ) ;
131128
132129 // All children should be BigInts
133130 children [ 0 ] . forEach ( child => {
@@ -140,11 +137,11 @@ describe('sequenceNumChildren', () => {
140137
141138 expect ( children ) . toHaveLength ( 3 ) ;
142139 children . forEach ( cellChildren => {
143- expect ( cellChildren . length ) . toBe ( 4 ) ; // aperture 4
140+ expect ( cellChildren . length ) . toBe ( 7 ) ; // 7 children for hexagons
144141 } ) ;
145142 } ) ;
146143
147- test ( 'number of children matches aperture ' , ( ) => {
144+ test ( 'number of children is consistent across apertures ' , ( ) => {
148145 // Test aperture 4
149146 dggs . setDggs ( {
150147 poleCoordinates : { lat : 0 , lng : 0 } ,
@@ -155,7 +152,7 @@ describe('sequenceNumChildren', () => {
155152 } , 3 ) ;
156153
157154 const children4 = dggs . sequenceNumChildren ( [ 10n ] , 3 ) ;
158- expect ( children4 [ 0 ] . length ) . toBe ( 4 ) ;
155+ expect ( children4 [ 0 ] . length ) . toBe ( 7 ) ;
159156
160157 // Test aperture 3
161158 dggs . setDggs ( {
@@ -167,7 +164,7 @@ describe('sequenceNumChildren', () => {
167164 } , 3 ) ;
168165
169166 const children3 = dggs . sequenceNumChildren ( [ 10n ] , 3 ) ;
170- expect ( children3 [ 0 ] . length ) . toBe ( 3 ) ;
167+ expect ( children3 [ 0 ] . length ) . toBe ( 7 ) ;
171168
172169 // Test aperture 7
173170 dggs . setDggs ( {
@@ -179,7 +176,7 @@ describe('sequenceNumChildren', () => {
179176 } , 3 ) ;
180177
181178 const children7 = dggs . sequenceNumChildren ( [ 10n ] , 3 ) ;
182- expect ( children7 [ 0 ] . length ) . toBe ( 7 ) ;
179+ expect ( children7 [ 0 ] . length ) . toBe ( 13 ) ;
183180
184181 // Reset to aperture 4 for other tests
185182 dggs . setDggs ( {
@@ -191,33 +188,29 @@ describe('sequenceNumChildren', () => {
191188 } , 5 ) ;
192189 } ) ;
193190
194- test ( 'all children should have the same parent' , ( ) => {
191+ test ( 'interior child has correct parent' , ( ) => {
195192 const parentId = 25n ;
196193 const children = dggs . sequenceNumChildren ( [ parentId ] , 4 ) ;
197194
198- // Get parents of all children
199- const parents = dggs . sequenceNumParent ( children [ 0 ] , 5 ) ;
195+ // Get parent of first child (interior child)
196+ const firstChildParent = dggs . sequenceNumParent ( [ children [ 0 ] [ 0 ] ] , 5 ) ;
200197
201- // All children should have the same parent
202- parents . forEach ( p => {
203- expect ( p ) . toBe ( parentId ) ;
204- } ) ;
198+ // The interior child should have the correct parent
199+ expect ( firstChildParent [ 0 ] ) . toBe ( parentId ) ;
205200 } ) ;
206201} ) ;
207202
208203// ── Integration Tests ────────────────────────────────────────────────────────
209204
210205describe ( 'hierarchical integration' , ( ) => {
211- test ( 'parent- child relationship is bidirectional' , ( ) => {
206+ test ( 'interior child-parent relationship is bidirectional' , ( ) => {
212207 // Get a cell's children
213208 const cellId = 50n ;
214209 const children = dggs . sequenceNumChildren ( [ cellId ] , 4 ) ;
215210
216- // Each child's parent should be the original cell
217- children [ 0 ] . forEach ( childId => {
218- const parent = dggs . sequenceNumParent ( [ childId ] , 5 ) ;
219- expect ( parent [ 0 ] ) . toBe ( cellId ) ;
220- } ) ;
211+ // The first child (interior) should have cellId as parent
212+ const firstChildParent = dggs . sequenceNumParent ( [ children [ 0 ] [ 0 ] ] , 5 ) ;
213+ expect ( firstChildParent [ 0 ] ) . toBe ( cellId ) ;
221214 } ) ;
222215
223216 test ( 'neighbors of parent include some neighbors of child' , ( ) => {
0 commit comments