Skip to content

Instantly share code, notes, and snippets.

@joeskeen
Created September 16, 2019 18:37
Show Gist options
  • Save joeskeen/05fde6456daa4bbdb6b34d34e20432d2 to your computer and use it in GitHub Desktop.
Save joeskeen/05fde6456daa4bbdb6b34d34e20432d2 to your computer and use it in GitHub Desktop.
a sample spec file for an isPalindrome function
describe('isPalindrome', () => {
describe('when provided a palindrome', () => {
describe('consisting of letters', () => {
it('should classify `"racecar"` as a palindrome');
describe('ignoring case', () => {
it('should classify `"Racecar"` as a palindrome');
});
describe('ignoring spaces', () => {
it('should classify `"taco cat"` as a palindrome');
});
describe('ignoring spaces, case, and punctuation', () => {
it('should classify `"Was it a car or a cat I saw?"` as a palindrome');
});
});
describe('consisting of numbers', () => {
it('should classify `"10801"` as a palindrome');
});
describe('consisting of symbols', () => {
it('should classify `"@#$%$#@"` as a palindrome');
});
});
describe('when provided a non-palindrome string value', () => {
describe('consisting of letters', () => {
it('should classify `"ice cream"` as not a palindrome');
});
describe('consisting of numbers', () => {
it('should classify `"314"` as not a palindrome');
});
describe('consisting of symbols', () => {
it('should classify `"!@#"` as not a palindrome');
});
});
describe('when provided a non-string value', () => {
it('should classify `null` as not a palindrome');
it('should classify `undefined` as not a palindrome');
it('should classify `{}` as not a palindrome');
it('should classify `[]` as not a palindrome');
it('should classify `true` as not a palindrome');
it('should classify `false` as not a palindrome');
it('should classify `NaN` as not a palindrome');
it('should classify `0` as not a palindrome');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment