adds tests for shift and unshift #69

Merged
merged 3 commits into from Jun 7, 2013

2 participants

@rockbot

:)

@rmurphey rmurphey commented on an outdated diff Jun 7, 2013
tests/app/arrays.js
@@ -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.shorten(a);
+
+ expect(result).to.have.length(3);
+ expect(result.join(' ')).to.eql('2 3 4');
+ });
@rmurphey
Owner
rmurphey added a note Jun 7, 2013

I don't love the name shorten, but I'm at a loss for a better name. Also, can you update this PR with stubs for these two methods in app/arrays.js? Bonus points if you add the answers to js-assessment-answers, too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@rockbot

I wasn't thrilled about "shorten" either, but "curtail" sounds kinda fancy ;-)

Answers will be added to js-assessment-answers shortly!

@rmurphey rmurphey merged commit 7b40503 into rmurphey:master Jun 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment