I'm not sure this is a good idea. It seems we'd want to test them more piece by piece.
Something like this for actions:
describe('hitUser()', function(){
it('returns with `type` "HIT_USER"', function(){
expect(gameActions.hitUser(this.deck, []).type).toEqual("HIT_USER")
})
it('returns with a `payload` with one less in the `deck`', function(){
console.log(`The deck length is ${this.deck.length}`)
const hitUserPayload = gameActions.hitUser(this.deck, []).payload;
expect(hitUserPayload.deck.length).toEqual(this.deck.length - 1);
})
it('returns with a `payload` with one more in the `userCards`', function(){
const userCards = [];
const hitUserPayload = gameActions.hitUser(this.deck, userCards).payload;
expect(hitUserPayload.aiCards.length).toEqual(userCards.length + 1)
})
})
Then given that the reducer is purely functional, those tests shouldn't be too bad to write.
I'm not sure this is a good idea. It seems we'd want to test them more piece by piece.
Something like this for actions:
Then given that the reducer is purely functional, those tests shouldn't be too bad to write.