Skip to content

Commit 7e2107c

Browse files
authored
Revert "Group A: FizzBuzz work" (#60)
This reverts commit e8be523.
1 parent e8be523 commit 7e2107c

File tree

7 files changed

+17
-399
lines changed

7 files changed

+17
-399
lines changed

katas/fizz-buzz/index.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

katas/fizz-buzz/package-lock.json

Lines changed: 0 additions & 218 deletions
This file was deleted.

katas/fizz-buzz/package.json

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
{
2-
"name": "fizzbuzz",
3-
"version": "1.0.0",
4-
"description": "FizzBuzz kata",
5-
"main": "index.js",
2+
"name": "fizz-buzz",
63
"scripts": {
7-
"test": "mocha -w --reporter spec"
4+
"test": "mocha -w"
85
},
9-
"author": "",
10-
"license": "ISC",
11-
"dependencies": {
12-
"chai": "^4.1.2",
13-
"mocha": "^5.2.0"
14-
},
15-
"devDependencies": {}
6+
"devDependencies": {
7+
"mocha": "3.2.0"
8+
}
169
}

katas/fizz-buzz/test.js

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,12 @@
1-
var fizzbuzz = require('./index').fizzbuzz;
2-
var printLines = require('./index').printLines;
1+
const assert = require('assert');
32

4-
var assert = require('chai').assert;
5-
6-
describe('Example test', function() {
3+
describe('Fizz Buzz Game', function() {
74

8-
it('does works', () => {
5+
it('works', () => {
96
const expected = true;
10-
const actual = true;
7+
const actual = false;
118

129
assert.equal(actual, expected);
1310
});
14-
});
15-
16-
describe('Fizz Buzz Game', function() {
17-
18-
// Put tests here
19-
it('1 should return 1', () => {
20-
assert.equal(fizzbuzz(1), 1);
21-
})
22-
23-
it('should return fizz divisible by 3', () => {
24-
assert.equal(fizzbuzz(3), 'fizz');
25-
assert.equal(fizzbuzz(6), 'fizz');
26-
27-
})
28-
29-
it('should return buzz divisible by 5', () => {
30-
assert.equal(fizzbuzz(5), 'buzz');
31-
assert.equal(fizzbuzz(20), 'buzz');
32-
33-
})
34-
35-
it('should return fizzbuzz if divisible by 15', () => {
36-
assert.equal(fizzbuzz(15), 'fizzbuzz');
37-
assert.equal(fizzbuzz(45), 'fizzbuzz');
38-
})
39-
40-
it('should return null if input not a number', () => {
41-
assert.equal(fizzbuzz('yes'), null);
42-
})
4311

4412
});
45-
46-
describe('Line Printer', function() {
47-
48-
it('Returns an array', () => {
49-
const actual = printLines(0);
50-
const expected = '';
51-
assert.strictEqual(actual, expected);
52-
})
53-
})

katas/yatzy/index.js

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,3 @@
1-
const _ = require('lodash')
2-
const CONSTRUCTOR_ERROR = new Error("The parameter should be an array of 5 integers between 1 and 6.");
3-
const NUMBER_OF_DICE = 5;
4-
const MAX_VALUE = 6;
5-
const MIN_VALUE = 1;
1+
function Yatzy(){}
62

7-
class Yatzy {
8-
constructor(diceRolls) {
9-
if (!_.isArray(diceRolls) || _.size(diceRolls) !== NUMBER_OF_DICE) {
10-
throw CONSTRUCTOR_ERROR
11-
}
12-
_.forEach(diceRolls, (diceRoll) => {
13-
if (!_.isInteger(diceRoll) || !_.inRange(diceRoll, MIN_VALUE, MAX_VALUE)) {
14-
throw CONSTRUCTOR_ERROR
15-
}
16-
})
17-
this.diceRolls = diceRolls
18-
}
19-
chance() {
20-
return _.sum(this.diceRolls)
21-
}
22-
yatzy() {
23-
if (_(this.diceRolls).uniq().size() === 1) {
24-
return _.sum(this.diceRolls)
25-
}
26-
return 0
27-
}
28-
number(value) {
29-
return _(this.diceRolls).filter(roll => roll === value).sum()
30-
}
31-
pair() {
32-
if (_(this.diceRolls).uniq().size() === 5) {
33-
return 0
34-
}
35-
return _(this.diceRolls).countBy().filter((val, key) => key > 1)
36-
.map((value, key) => value * 2).max()
37-
// TODO: FIXME
38-
// TODO: find ressource to explain async and functions as arguments
39-
// TODO: find resources to explain how to setup
40-
}
41-
}
42-
module.exports = Yatzy;
3+
module.exports = yatzy;

katas/yatzy/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
"description": "This Refactoring Kata was designed by Jon Jagger and is available in his Cyber-Dojo. See [his blog post](http://jonjagger.blogspot.co.uk/2012/05/yahtzee-cyber-dojo-refactoring-in-java.html)",
55
"main": "index.js",
66
"scripts": {
7-
"test": "mocha -w",
8-
"test:coverage": "nyc mocha"
7+
"test": "mocha -w"
98
},
109
"devDependencies": {
1110
"mocha": "3.2.0"
1211
},
1312
"dependencies": {
14-
"chai": "^4.1.2",
15-
"lodash": "^4.17.10",
16-
"nyc": "^11.8.0"
13+
"chai": "^4.1.2"
1714
}
1815
}

0 commit comments

Comments
 (0)