Skip to content

Commit 4f694ff

Browse files
committed
resolved task 2 from chapter 4.5
1 parent fa374bd commit 4f694ff

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!doctype html>
2+
<script src="https://ru.js.cx/test/libs.js"></script>
3+
<script src="test.js"></script>
4+
<script>
5+
6+
function Accumulator(stringValue) {
7+
this.value = Number(stringValue),
8+
9+
this.read = function(stringValue) {
10+
this.value += Number(stringValue);
11+
}
12+
};
13+
14+
</script>
15+
16+
</html>

exercises/chapter_04.5_task_2/test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
describe("Calculator", function() {
2+
3+
context("Simple tests", function() {
4+
it("Begin from 4 and add 2 = 6", function() {
5+
let acc = new Accumulator("4")
6+
acc.read("2")
7+
assert.equal(acc.value, 6);
8+
});
9+
});
10+
});

0 commit comments

Comments
 (0)