Skip to content

Commit

Permalink
Merge pull request #69 from rockbot/add-shift-unshift
Browse files Browse the repository at this point in the history
adds tests for shift and unshift
  • Loading branch information
rmurphey committed Jun 7, 2013
2 parents e043544 + 18a8d3f commit 7b40503
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ define(function() {

},

prepend : function(arr, item) {

},

curtail : function(arr) {

},

concat : function(arr1, arr2) {

},
Expand Down
14 changes: 14 additions & 0 deletions tests/app/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ define([
expect(result.join(' ')).to.eql('1 2 3');
});

it('you should be able to add an item to the beginning of an array', function () {
var result = answers.prepend(a, 10);

expect(result).to.have.length(5);
expect(result[0]).to.eql(10);
});

it('you should be able to remove the first item of an array', function () {
var result = answers.curtail(a);

expect(result).to.have.length(3);
expect(result.join(' ')).to.eql('2 3 4');
});

it('you should be able to join together two arrays', function() {
var c = [ 'a', 'b', 'c', 1 ],
result = answers.concat(a, c);
Expand Down

0 comments on commit 7b40503

Please sign in to comment.