Skip to content

Commit fc946c3

Browse files
committed
add: test cases for set
1 parent 2bf123a commit fc946c3

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

test/immutable_sequence.test.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ describe('Immutable Sequence', function () {
3737
s.peekLast().should.equal(3);
3838
});
3939

40-
it('should be able to add an element to the end', function () {
41-
var s = ImmutableSequence.fromArray([]);
42-
s = s.addLast(1);
43-
s.size().should.eql(1);
44-
});
45-
46-
it('should be able to add an element to the front', function () {
47-
var s = ImmutableSequence.fromArray([]);
48-
s = s.addFirst(1);
49-
s.size().should.eql(1);
50-
});
51-
5240
it('should be able get the element at a certain position', function () {
5341
var s = ImmutableSequence.fromArray([1, 2, 3]);
5442
s.get(0).should.eql(1);
@@ -67,6 +55,24 @@ describe('Immutable Sequence', function () {
6755
}).should.throw();
6856
});
6957

58+
it('should be able to set the element at a certain position', function () {
59+
var s = ImmutableSequence.fromArray([1, 2, 3]);
60+
s = s.set(1, 3);
61+
s.get(1).should.eql(3);
62+
});
63+
64+
it('should be able to add an element to the front', function () {
65+
var s = ImmutableSequence.fromArray([]);
66+
s = s.addFirst(1);
67+
s.size().should.eql(1);
68+
});
69+
70+
it('should be able to add an element to the end', function () {
71+
var s = ImmutableSequence.fromArray([]);
72+
s = s.addLast(1);
73+
s.size().should.eql(1);
74+
});
75+
7076
it('should be able to remove an element from the front', function () {
7177
var s = ImmutableSequence.fromArray([1, 2, 3]);
7278
s = s.removeFirst();

0 commit comments

Comments
 (0)