Skip to content

Instantly share code, notes, and snippets.

@rbinksy
Created March 4, 2020 08:38
Show Gist options
  • Save rbinksy/7b96a785d517b46bc4861b5b121c7cb7 to your computer and use it in GitHub Desktop.
Save rbinksy/7b96a785d517b46bc4861b5b121c7cb7 to your computer and use it in GitHub Desktop.
import React from 'react';
import { Status } from './Status';
import renderWithRedux from 'utils/renderWithRedux';
test('When monster takes damage, show success message', () => {
const { getByText } = renderWithRedux(<Status />, {
monster: { damageTaken: 2 }
});
expect(getByText('You hit for 2!'));
});
test('When player takes damage, show fail message', () => {
const { getByText } = renderWithRedux(<Status />, {
player: { damageTaken: 4 }
});
expect(getByText('Ouch! you took 4 hits!'));
});
test('When no damage is taken and is at least the first round, show draw message', () => {
const { getByText } = renderWithRedux(<Status />, {
player: { damageTaken: 0 },
monster: { damageTaken: 0 },
game: { currentRound: 1 }
});
expect(getByText('Draw! Fight again!'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment