@@ -116,6 +116,12 @@ describe('LinkedList Test', () => {
116
116
linkedList . addLast ( 'found' ) ;
117
117
} ) ;
118
118
119
+ describe ( '#length' , ( ) => {
120
+ it ( 'should have length property' , ( ) => {
121
+ expect ( linkedList . length ) . toBe ( 2 ) ;
122
+ } ) ;
123
+ } ) ;
124
+
119
125
describe ( '#indexOf' , ( ) => {
120
126
it ( 'should find element index' , ( ) => {
121
127
expect ( linkedList . indexOf ( 0 ) ) . toBe ( 0 ) ;
@@ -203,6 +209,20 @@ describe('LinkedList Test', () => {
203
209
expect ( linkedList . size ) . toBe ( 2 ) ;
204
210
} ) ;
205
211
} ) ;
212
+
213
+ describe ( '#removeByPosition' , ( ) => {
214
+ it ( 'should remove last element' , ( ) => {
215
+ expect ( linkedList . length ) . toBe ( 2 ) ;
216
+ expect ( linkedList . removeByPosition ( 1 ) ) . toBe ( 'found' ) ;
217
+ expect ( linkedList . length ) . toBe ( 1 ) ;
218
+ } ) ;
219
+
220
+ it ( 'should remove last element' , ( ) => {
221
+ expect ( linkedList . length ) . toBe ( 2 ) ;
222
+ expect ( linkedList . removeByPosition ( 0 ) ) . toBe ( 0 ) ;
223
+ expect ( linkedList . length ) . toBe ( 1 ) ;
224
+ } ) ;
225
+ } ) ;
206
226
} ) ;
207
227
208
228
describe ( 'Doubly Linked List and aliases' , ( ) => {
0 commit comments