diff --git a/test/arithmetic.test.js b/test/arithmetic.test.js index deded48..71031e7 100644 --- a/test/arithmetic.test.js +++ b/test/arithmetic.test.js @@ -94,7 +94,56 @@ describe('Arithmetic', function () { }); // TODO: Challenge #1 - +describe('Power', function () { + it('raises a positive integer to the power of another positive integer', function (done) { + request.get('/arithmetic?operation=power&operand1=2&operand2=3') + .expect(200) + .end(function (err, res) { + expect(res.body).to.eql({ result: 8 }); + done(); + }); + }); + it('raises a positive integer to the power of zero', function (done) { + request.get('/arithmetic?operation=power&operand1=2&operand2=0') + .expect(200) + .end(function (err, res) { + expect(res.body).to.eql({ result: 1 }); + done(); + }); + }); + it('raises zero to the power of a positive integer', function (done) { + request.get('/arithmetic?operation=power&operand1=0&operand2=3') + .expect(200) + .end(function (err, res) { + expect(res.body).to.eql({ result: 0 }); + done(); + }); + }); + it('raises a negative integer to the power of a positive integer', function (done) { + request.get('/arithmetic?operation=power&operand1=-2&operand2=3') + .expect(200) + .end(function (err, res) { + expect(res.body).to.eql({ result: -8 }); + done(); + }); + }); + it('raises a positive integer to the power of a negative integer', function (done) { + request.get('/arithmetic?operation=power&operand1=2&operand2=-3') + .expect(200) + .end(function (err, res) { + expect(res.body).to.eql({ result: 0.125 }); + done(); + }); + }); + it('raises a floating point number to the power of an integer', function (done) { + request.get('/arithmetic?operation=power&operand1=2.5&operand2=2') + .expect(200) + .end(function (err, res) { + expect(res.body).to.eql({ result: 6.25 }); + done(); + }); + }); +}); describe('Multiplication', function () { it('multiplies two positive integers', function (done) {