@@ -326,7 +326,7 @@ describe("CollectionUtils", () => {
326326 type TestType = { id : number } ;
327327 const selector = ( t : TestType ) => t . id ;
328328
329- it ( "When collections are different lengths, then returns false" , ( ) => {
329+ it ( "when collections are different lengths, then returns false" , ( ) => {
330330 // Arrange
331331 const arr1 : Array < TestType > = [ { id : 1 } , { id : 2 } ] ;
332332 const arr2 : Array < TestType > = [ { id : 1 } ] ;
@@ -338,7 +338,7 @@ describe("CollectionUtils", () => {
338338 expect ( result ) . toBe ( false ) ;
339339 } ) ;
340340
341- it ( "When one of the collections is null, then returns false" , ( ) => {
341+ it ( "when one of the collections is null, then returns false" , ( ) => {
342342 // Arrange
343343 const arr1 : Array < TestType > = [ { id : 1 } , { id : 2 } ] ;
344344
@@ -349,7 +349,7 @@ describe("CollectionUtils", () => {
349349 expect ( result ) . toBe ( false ) ;
350350 } ) ;
351351
352- it ( "When both collections are null, then returns true" , ( ) => {
352+ it ( "when both collections are null, then returns true" , ( ) => {
353353 // Act
354354 const result = CollectionUtils . equalsBy (
355355 selector ,
@@ -361,7 +361,7 @@ describe("CollectionUtils", () => {
361361 expect ( result ) . toBe ( true ) ;
362362 } ) ;
363363
364- it ( "When collections are equal size but contain different elements, then returns false" , ( ) => {
364+ it ( "when collections are equal size but contain different elements, then returns false" , ( ) => {
365365 // Arrange
366366 const arr1 : Array < TestType > = [ { id : 1 } , { id : 2 } ] ;
367367 const arr2 : Array < TestType > = [ { id : 2 } , { id : 3 } ] ;
@@ -373,7 +373,7 @@ describe("CollectionUtils", () => {
373373 expect ( result ) . toBe ( false ) ;
374374 } ) ;
375375
376- it ( "When collections are identical, then returns true" , ( ) => {
376+ it ( "when collections are identical, then returns true" , ( ) => {
377377 // Arrange
378378 const arr1 : Array < TestType > = [ { id : 1 } , { id : 2 } ] ;
379379 const arr2 : Array < TestType > = [ ...arr1 ] ;
@@ -386,6 +386,45 @@ describe("CollectionUtils", () => {
386386 } ) ;
387387 } ) ;
388388
389+ describe ( "#removeElementAt" , ( ) => {
390+ it ( "when index i < 0, returns source array" , ( ) => {
391+ // Arrange
392+ const arr = [ "one" , "two" , "three" ] ;
393+ const expected = [ ...arr ] ;
394+
395+ // Act
396+ const result = CollectionUtils . removeElementAt ( arr , - 1 ) ;
397+
398+ // Assert
399+ expect ( result ) . toStrictEqual ( expected ) ;
400+ } ) ;
401+
402+ it ( "when index > array.length, returns source array" , ( ) => {
403+ // Arrange
404+ const arr = [ "one" , "two" , "three" ] ;
405+ const expected = [ ...arr ] ;
406+
407+ // Act
408+ const result = CollectionUtils . removeElementAt ( arr , 50 ) ;
409+
410+ // Assert
411+ expect ( result ) . toStrictEqual ( expected ) ;
412+ } ) ;
413+
414+ it ( "when index is in range, then removes element at index" , ( ) => {
415+ // Arrange
416+ const arr = [ "one" , "two" , "three" ] ;
417+ const expected = [ "one" , "three" ] ;
418+ const indexToRemove = 1 ;
419+
420+ // Act
421+ const result = CollectionUtils . removeElementAt ( arr , indexToRemove ) ;
422+
423+ // Assert
424+ expect ( result ) . toStrictEqual ( expected ) ;
425+ } ) ;
426+ } ) ;
427+
389428 describe ( "#replaceElementAt" , ( ) => {
390429 it ( "Replaces element at specified index and returns a new array" , ( ) => {
391430 // Arrange
0 commit comments