Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying the Add Function #1089

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Calculator.js: a node.js Demonstration Project
An example node.js project, including tests with mocha, that behaves like
a pocket calculator.

[![Build Status](https://dev.azure.com/k200342/Integrating%20External%20Source%20Control%20with%20Azure%20Pipelines/_apis/build/status%2FAmmar-Siddique.calculator?branchName=master)](https://dev.azure.com/k200342/Integrating%20External%20Source%20Control%20with%20Azure%20Pipelines/_build/latest?definitionId=2&branchName=master)
The project contains a simple node.js application that exposes REST APIs
to perform arithmetic on integers, and provides a test suite with mocha
and chai. The `mocha-junit-reporters` package is included to provide XML
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/arithmeticController.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.calculate = function(req, res) {
});

var operations = {
'add': function(a,b) { return +a + +b },
'add': function(a,b) { return +a + +b }, // Using + operator to type cast variables as integers in order to prevent string concatenation.
'subtract': function(a,b) { return a - b },
'multiply': function(a,b) { return a * b },
'divide': function(a,b) { return a / b },
Expand Down
22 changes: 22 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
vmImage: ubuntu-latest

steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'

- script: |
npm install
npm run build
npm test
displayName: 'npm install, build, and test'