diff --git a/api/controllers/arithmeticController.js b/api/controllers/arithmeticController.js index 0fccf513d7..b113a299ad 100644 --- a/api/controllers/arithmeticController.js +++ b/api/controllers/arithmeticController.js @@ -11,7 +11,8 @@ exports.calculate = function(req, res) { }); var operations = { - 'add': function(a,b) { return +a + +b }, + // Using + operator to type cast variables as integers in order to prevent string concatenation. + 'add': function(a,b) { return +a + +b }, 'subtract': function(a,b) { return a - b }, 'multiply': function(a,b) { return a * b }, 'divide': function(a,b) { return a / b }, diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..c55454d856 --- /dev/null +++ b/azure-pipelines.yml @@ -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'