Skip to content

Instantly share code, notes, and snippets.

@ericdouglas
Last active August 29, 2015 13:56
Show Gist options
  • Save ericdouglas/8974497 to your computer and use it in GitHub Desktop.
Save ericdouglas/8974497 to your computer and use it in GitHub Desktop.
Test and debug returning different values
describe('function that sum numbers between 1 and 100', function () {
var out = sum;
it('verify if the sum is correct', function () {
expect( out ).toBeDefined();
expect( out() ).toBe( 5050 );
});
});
var
count = 1,
limit = 100,
result = 0;
function sum () {
for ( ; count <= limit; count += 1 )
result += count;
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment