Browse Source

SpecialKarten erstellt + UnitTests

- ChooseColor
- Reverse
- Skip
main
Nicolas Fritz 2 years ago
parent
commit
14f44ee21f
  1. 10
      uno/js/cards/special/ChooseColor.js
  2. 8
      uno/js/cards/special/Reverse.js
  3. 9
      uno/js/cards/special/Skip.js
  4. 36
      uno/tests/test_Card.test.js

10
uno/js/cards/special/ChooseColor.js

@ -0,0 +1,10 @@
const Card = require('../Card');
const uno = require('../../uno');
class ChooseColor extends Card {
constructor(name) {
super(name, uno.CARD_COLORS[0]);
}
}
module.exports = ChooseColor;

8
uno/js/cards/special/Reverse.js

@ -0,0 +1,8 @@
const Card = require('../Card');
class Reverse extends Card {
constructor(name, color) {
super(name, color);
}
}
module.exports = Reverse;

9
uno/js/cards/special/Skip.js

@ -0,0 +1,9 @@
const Card = require('../Card');
class Skip extends Card {
constructor(name, color) {
super(name, color);
}
}
module.exports = Skip;

36
uno/tests/test_Card.test.js

@ -1,6 +1,9 @@
//Imports //Imports
const uno = require('../js/uno'); const uno = require('../js/uno');
const Card = require('../js/cards/Card'); const Card = require('../js/cards/Card');
const ChooseColor = require('../js/cards/special/ChooseColor');
const Skip = require('../js/cards/special/Skip');
const Reverse = require('../js/cards/special/Reverse');
//Instanz CARD_COLORS aus uno.js //Instanz CARD_COLORS aus uno.js
const CARD_COLORS = uno.CARD_COLORS; const CARD_COLORS = uno.CARD_COLORS;
@ -32,6 +35,39 @@ describe('Karten erstellen', () => {
}); });
it('ChooseColor', () => {
//Erstellen einer +2 Karte:
//Name: CC, Farbe: keine
card = new ChooseColor('CC');
//Testet das Erstellen der Karte
testCreatedCard(card, 'CC', "NONE");
});
it('Skip - Gelb', () => {
//Erstellen einer Skip Karte:
//Name: Skip, Farbe: gelb
card = new Skip('S', CARD_COLORS[4]);
//Testet das Erstellen der Karte
testCreatedCard(card, 'S', "YELLOW");
});
it('Reverse - Grün', () => {
//Erstellen einer Reverse Karte:
//Name: Reverse, Farbe: grün
card = new Reverse('R', CARD_COLORS[2]);
//Testet das Erstellen der Karte
testCreatedCard(card, 'R', "GREEN");
});
}); });
//Testet eine Karte auf die Eigenschaften von Card.js //Testet eine Karte auf die Eigenschaften von Card.js

Loading…
Cancel
Save