mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-07-13 21:15:35 +08:00
fix(curriculum): add more tests for the golf translator lab (#62248)
This commit is contained in:
parent
5ada45dc60
commit
62c47f46e5
@ -46,12 +46,30 @@ assert.lengthOf(golfScore, 2);
|
||||
assert.isString(golfScore(4,1));
|
||||
```
|
||||
|
||||
`golfScore(1, 1)` should return the string `Hole-in-one!`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(1,1), 'Hole-in-one!');
|
||||
```
|
||||
|
||||
`golfScore(3, 1)` should return the string `Hole-in-one!`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(3,1), 'Hole-in-one!');
|
||||
```
|
||||
|
||||
`golfScore(4, 1)` should return the string `Hole-in-one!`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(4,1), 'Hole-in-one!');
|
||||
```
|
||||
|
||||
`golfScore(5, 1)` should return the string `Hole-in-one!`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(5,1), 'Hole-in-one!');
|
||||
```
|
||||
|
||||
`golfScore(4, 2)` should return the string `Eagle`
|
||||
|
||||
```js
|
||||
@ -64,46 +82,88 @@ assert.strictEqual(golfScore(4,2), 'Eagle');
|
||||
assert.strictEqual(golfScore(5,2), 'Eagle');
|
||||
```
|
||||
|
||||
`golfScore(3, 2)` should return the string `Birdie`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(3,2), 'Birdie');
|
||||
```
|
||||
|
||||
`golfScore(4, 3)` should return the string `Birdie`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(4,3), 'Birdie');
|
||||
```
|
||||
|
||||
`golfScore(5, 4)` should return the string `Birdie`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(5,4), 'Birdie');
|
||||
```
|
||||
|
||||
`golfScore(3, 3)` should return the string `Par`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(3,3), 'Par');
|
||||
```
|
||||
|
||||
`golfScore(4, 4)` should return the string `Par`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(4,4), 'Par');
|
||||
```
|
||||
|
||||
`golfScore(1, 1)` should return the string `Hole-in-one!`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(1,1), 'Hole-in-one!');
|
||||
```
|
||||
|
||||
`golfScore(5, 5)` should return the string `Par`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(5,5), 'Par');
|
||||
```
|
||||
|
||||
`golfScore(3, 4)` should return the string `Bogey`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(3,4), 'Bogey');
|
||||
```
|
||||
|
||||
`golfScore(4, 5)` should return the string `Bogey`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(4,5), 'Bogey');
|
||||
```
|
||||
|
||||
`golfScore(5, 6)` should return the string `Bogey`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(5,6), 'Bogey');
|
||||
```
|
||||
|
||||
`golfScore(3, 5)` should return the string `Double Bogey`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(3,5), 'Double Bogey');
|
||||
```
|
||||
|
||||
`golfScore(4, 6)` should return the string `Double Bogey`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(4,6), 'Double Bogey');
|
||||
```
|
||||
|
||||
`golfScore(4, 7)` should return the string `Go Home!`
|
||||
`golfScore(5, 7)` should return the string `Double Bogey`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(4,7), 'Go Home!');
|
||||
assert.strictEqual(golfScore(5,7), 'Double Bogey');
|
||||
```
|
||||
|
||||
`golfScore(3, 7)` should return the string `Go Home!`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(3,7), 'Go Home!');
|
||||
```
|
||||
|
||||
`golfScore(4, 8)` should return the string `Go Home!`
|
||||
|
||||
```js
|
||||
assert.strictEqual(golfScore(4,8), 'Go Home!');
|
||||
```
|
||||
|
||||
`golfScore(5, 9)` should return the string `Go Home!`
|
||||
@ -121,7 +181,6 @@ const names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey"
|
||||
|
||||
```
|
||||
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
@ -153,4 +212,3 @@ function golfScore(par, strokes) {
|
||||
return "Go Home!";
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user