@@ -13,6 +13,22 @@ describe('Immutable Sequence', function () {
13
13
s . size ( ) . should . eql ( 3 ) ;
14
14
} ) ;
15
15
16
+ it ( 'should be able to get the first element' , function ( ) {
17
+ var s = ImmutableSequence . fromArray ( [ ] ) ;
18
+ ( s . peekFirst ( ) === null ) . should . be . true ;
19
+
20
+ s = ImmutableSequence . fromArray ( [ 1 , 2 , 3 ] ) ;
21
+ s . peekFirst ( ) . should . equal ( 1 ) ;
22
+ } ) ;
23
+
24
+ it ( 'should be able to get the last element' , function ( ) {
25
+ var s = ImmutableSequence . fromArray ( [ ] ) ;
26
+ ( s . peekLast ( ) === null ) . should . be . true ;
27
+
28
+ s = ImmutableSequence . fromArray ( [ 1 , 2 , 3 ] ) ;
29
+ s . peekLast ( ) . should . equal ( 3 ) ;
30
+ } ) ;
31
+
16
32
it ( 'should be able to add an element to the end' , function ( ) {
17
33
var s = ImmutableSequence . fromArray ( [ ] ) ;
18
34
s = s . addLast ( 1 ) ;
@@ -43,6 +59,22 @@ describe('Immutable Sequence', function () {
43
59
} ) . should . throw ( ) ;
44
60
} ) ;
45
61
62
+ it ( 'should be able to remove an element from the front' , function ( ) {
63
+ var s = ImmutableSequence . fromArray ( [ 1 , 2 , 3 ] ) ;
64
+ s = s . removeFirst ( ) ;
65
+ s . size ( ) . should . equal ( 2 ) ;
66
+ s . peekFirst ( ) . should . equal ( 2 ) ;
67
+ s . peekLast ( ) . should . equal ( 3 ) ;
68
+ } ) ;
69
+
70
+ it ( 'should be able to remove an element from the end' , function ( ) {
71
+ var s = ImmutableSequence . fromArray ( [ 1 , 2 , 3 ] ) ;
72
+ s = s . removeLast ( ) ;
73
+ s . size ( ) . should . equal ( 2 ) ;
74
+ s . peekFirst ( ) . should . equal ( 1 ) ;
75
+ s . peekLast ( ) . should . equal ( 2 ) ;
76
+ } ) ;
77
+
46
78
it ( 'should be able to split at a certain position' , function ( ) {
47
79
var s = ImmutableSequence . fromArray ( [ 1 , 2 , 3 ] ) ;
48
80
var split = s . splitAt ( 1 ) ;
0 commit comments