Skip to content

Commit

Permalink
chapter 02: add a inmemory calculator to continuing trying state-base…
Browse files Browse the repository at this point in the history
…d testing
  • Loading branch information
devcorpio committed Jan 9, 2019
1 parent 8d21eb8 commit 9b319ea
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions chapter_02-a-first-unit-test/MemCalculator/memCalculator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function memCalculator() {
/**
* @type {number}
*/
let sum = 0;

/**
* @param {number} number
*/
function add(number) {
sum += number;
}

/**
* @return {number}
*/
function result() {
/**
* @type {number};
*/
const temp = sum;
sum = 0;

return temp;
}
}

module.exports = memCalculator;

0 comments on commit 9b319ea

Please sign in to comment.