@@ -10,17 +10,17 @@ describe('LinkedList', function () {
10
10
describe ( '#addLast' , ( ) => {
11
11
it ( 'should add element to end/tail of the list' , ( ) => {
12
12
linkedList . addLast ( 'a' ) ;
13
- expect ( linkedList . root . value ) . toBe ( 'a' ) ;
13
+ expect ( linkedList . first . value ) . toBe ( 'a' ) ;
14
14
} ) ;
15
15
16
16
it ( 'should link values' , ( ) => {
17
17
linkedList . addLast ( 'a' ) ;
18
18
linkedList . addLast ( 'b' ) ;
19
19
linkedList . addLast ( 'c' ) ;
20
20
21
- expect ( linkedList . root . value ) . toBe ( 'a' ) ;
22
- expect ( linkedList . root . next . value ) . toBe ( 'b' ) ;
23
- expect ( linkedList . root . next . next . value ) . toBe ( 'c' ) ;
21
+ expect ( linkedList . first . value ) . toBe ( 'a' ) ;
22
+ expect ( linkedList . first . next . value ) . toBe ( 'b' ) ;
23
+ expect ( linkedList . first . next . next . value ) . toBe ( 'c' ) ;
24
24
} ) ;
25
25
} ) ;
26
26
@@ -32,8 +32,8 @@ describe('LinkedList', function () {
32
32
33
33
it ( 'should remove first item: a' , ( ) => {
34
34
expect ( linkedList . removeFirst ( ) ) . toBe ( 'a' ) ;
35
- expect ( linkedList . root . value ) . toBe ( 'b' ) ;
36
- expect ( linkedList . root . next ) . toBe ( null ) ;
35
+ expect ( linkedList . first . value ) . toBe ( 'b' ) ;
36
+ expect ( linkedList . first . next ) . toBe ( null ) ;
37
37
38
38
expect ( linkedList . removeFirst ( ) ) . toBe ( 'b' ) ;
39
39
expect ( linkedList . removeFirst ( ) ) . toBe ( undefined ) ;
@@ -44,14 +44,14 @@ describe('LinkedList', function () {
44
44
describe ( '#addFirst' , ( ) => {
45
45
it ( 'add element to the head/root of the list' , ( ) => {
46
46
linkedList . addFirst ( 'a' ) ;
47
- expect ( linkedList . root . value ) . toBe ( 'a' ) ;
47
+ expect ( linkedList . first . value ) . toBe ( 'a' ) ;
48
48
} ) ;
49
49
50
50
it ( 'add element to the head/root of the list' , ( ) => {
51
51
linkedList . addFirst ( 'a' ) ;
52
52
linkedList . addFirst ( 'b' ) ;
53
- expect ( linkedList . root . value ) . toBe ( 'b' ) ;
54
- expect ( linkedList . root . next . value ) . toBe ( 'a' ) ;
53
+ expect ( linkedList . first . value ) . toBe ( 'b' ) ;
54
+ expect ( linkedList . first . next . value ) . toBe ( 'a' ) ;
55
55
} ) ;
56
56
} ) ;
57
57
@@ -65,8 +65,8 @@ describe('LinkedList', function () {
65
65
it ( 'should remove first item' , ( ) => {
66
66
expect ( linkedList . removeLast ( ) ) . toBe ( 'c' ) ;
67
67
expect ( linkedList . removeLast ( ) ) . toBe ( 'b' ) ;
68
- expect ( linkedList . root . value ) . toBe ( 'a' ) ;
69
- expect ( linkedList . root . next ) . toBe ( null ) ;
68
+ expect ( linkedList . first . value ) . toBe ( 'a' ) ;
69
+ expect ( linkedList . first . next ) . toBe ( null ) ;
70
70
71
71
expect ( linkedList . removeLast ( ) ) . toBe ( 'a' ) ;
72
72
expect ( linkedList . removeLast ( ) ) . toBe ( undefined ) ;
0 commit comments