@@ -248,6 +248,44 @@ describe('List', () => {
248248 } )
249249 } )
250250
251+ describe ( 'isFirst' , ( ) => {
252+ it ( 'should return true for index 0' , ( ) => {
253+ const list = List . of ( 1 , 2 , 3 )
254+ expect ( list . isFirst ( 0 ) ) . toBe ( true )
255+ } )
256+
257+ it ( 'should return false for other indices' , ( ) => {
258+ const list = List . of ( 1 , 2 , 3 )
259+ expect ( list . isFirst ( 1 ) ) . toBe ( false )
260+ expect ( list . isFirst ( 2 ) ) . toBe ( false )
261+ expect ( list . isFirst ( - 1 ) ) . toBe ( false )
262+ } )
263+
264+ it ( 'should handle empty list' , ( ) => {
265+ const list = List . empty ( )
266+ expect ( list . isFirst ( 0 ) ) . toBe ( false )
267+ } )
268+ } )
269+
270+ describe ( 'isLast' , ( ) => {
271+ it ( 'should return true for last index' , ( ) => {
272+ const list = List . of ( 1 , 2 , 3 )
273+ expect ( list . isLast ( 2 ) ) . toBe ( true )
274+ } )
275+
276+ it ( 'should return false for other indices' , ( ) => {
277+ const list = List . of ( 1 , 2 , 3 )
278+ expect ( list . isLast ( 0 ) ) . toBe ( false )
279+ expect ( list . isLast ( 1 ) ) . toBe ( false )
280+ expect ( list . isLast ( - 1 ) ) . toBe ( false )
281+ } )
282+
283+ it ( 'should handle empty list' , ( ) => {
284+ const list = List . empty ( )
285+ expect ( list . isLast ( 0 ) ) . toBe ( false )
286+ } )
287+ } )
288+
251289 describe ( 'difference' , ( ) => {
252290 it ( 'should return items in first list but not in second' , ( ) => {
253291 const list1 = List . of ( 1 , 2 , 3 , 4 )
0 commit comments