|
1 | | -beforeEach(function() { |
| 1 | +beforeEach(function () { |
2 | 2 | sinon.stub(window, "prompt"); |
3 | 3 | }); |
4 | 4 |
|
5 | | -afterEach(function() { |
| 5 | +afterEach(function () { |
6 | 6 | prompt.restore(); |
7 | 7 | }); |
8 | 8 |
|
9 | | -describe("readNumber", function() { |
| 9 | +describe("readNumber", function () { |
10 | 10 |
|
11 | | - it("if a number, returns it", function() { |
| 11 | + it("hvis et tal, returnerer det", function () { |
12 | 12 | prompt.returns("123"); |
13 | 13 | assert.strictEqual(readNumber(), 123); |
14 | 14 | }); |
15 | 15 |
|
16 | | - it("if 0, returns it", function() { |
| 16 | + it("hvis 0, returnerer det", function () { |
17 | 17 | prompt.returns("0"); |
18 | 18 | assert.strictEqual(readNumber(), 0); |
19 | 19 | }); |
20 | 20 |
|
21 | | - it("continues the loop until meets a number", function() { |
22 | | - prompt.onCall(0).returns("not a number"); |
23 | | - prompt.onCall(1).returns("not a number again"); |
| 21 | + it("fortsætter løkken indtil et tal indtastes", function () { |
| 22 | + prompt.onCall(0).returns("ikke et tal"); |
| 23 | + prompt.onCall(1).returns("ikke et tal igen"); |
24 | 24 | prompt.onCall(2).returns("1"); |
25 | 25 | assert.strictEqual(readNumber(), 1); |
26 | 26 | }); |
27 | 27 |
|
28 | | - it("if an empty line, returns null", function() { |
| 28 | + it("hvis en tom linje, returnerer null", function () { |
29 | 29 | prompt.returns(""); |
30 | 30 | assert.isNull(readNumber()); |
31 | 31 | }); |
32 | 32 |
|
33 | | - it("if cancel, returns null", function() { |
| 33 | + it("hvis annuller, returnerer null", function () { |
34 | 34 | prompt.returns(null); |
35 | 35 | assert.isNull(readNumber()); |
36 | 36 | }); |
|
0 commit comments