Created
July 3, 2017 16:27
-
-
Save dtanzer/d8e746f19e0541e355aa59fc301b5683 to your computer and use it in GitHub Desktop.
Tests for a fictional hangman game, with groups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Hangman - Implements the flow of a single Hangman game, given a secret word.', () => { | |
describe('Generates Hints from the secret word and the input', () => { | |
it('returns a hint that contains only underscores at the start of the game', () => { /* ... */}); | |
['test', 'a', 'few', 'cases'].forEach(secretWord => { | |
it('shows a hint with the correct length for the secret word "'+secretWord+'" at the start of the game', () => { | |
/* ... */ | |
}); | |
}); | |
[[['c'], 'c____'], [['c', 's'], 'c_s_s'], [['c', 's', 'e'], 'c_ses']].forEach(data => { | |
it('updates hint to "'+data[1]+'" after guessing "'+data[0]+'" when word is "cases"', () => { | |
/* ... */ | |
}); | |
}); | |
it('does not update the hint when making a wrong guess', () => { | |
/* ... */ | |
}); | |
}); | |
describe('Keeps track of remaining guesses, so UI can draw the gallows pole', () => { | |
it('decrements the number of remaining tries after a wrong guess', () => { | |
/* ... */ | |
}); | |
it('does not decrement the number of wrong guesses after a right guess', () => { | |
/* ... */ | |
}); | |
}); | |
describe('Keeps track of whether the game is running or over (Won / Lost', () => { | |
it('indicates game is over ("Lost") when there was only one guess remaining and the user guessed wrong', () => { | |
/* ... */ | |
}); | |
it('indicates game is over ("Won") when the user guessed all letters of the secret word', () => { | |
/* ... */ | |
}); | |
it('does not accept any input after the game is over', () => { | |
/* ... */ | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment