Skip to content

Instantly share code, notes, and snippets.

@adnanrahic
Created August 19, 2017 15:56
Show Gist options
  • Save adnanrahic/4c8092efc8126126414c693f54297796 to your computer and use it in GitHub Desktop.
Save adnanrahic/4c8092efc8126126414c693f54297796 to your computer and use it in GitHub Desktop.
function addTwoNumbers(x, y) {
return x + y;
}
function testAddTwoNumbers() {
// 1. ARRANGE
var x = 5;
var y = 1;
var sum1 = x + y;
// 2. ACT
var sum2 = addTwoNumbers(x, y);
console.log('addTwoNumbers() should return the sum of its two parameters.');
console.log('Expect ' + sum1 + ' to equal ' + sum2 + '.');
// 3. ASSERT
if ( sum1 === sum2 )
return console.log('Passed.');
console.log('Failed.');
}
testAddTwoNumbers();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment