Skip to content

Instantly share code, notes, and snippets.

@desmondrawls
Created May 9, 2019 03:39
Show Gist options
  • Save desmondrawls/c847dacd2e574e84c7ee7cac1e73986e to your computer and use it in GitHub Desktop.
Save desmondrawls/c847dacd2e574e84c7ee7cac1e73986e to your computer and use it in GitHub Desktop.
import {fizzbuzz} from './fizzbuzz'
describe('fizzbuzz', () => {
describe('numbers that are not multiples of 3 or 5', () => {
it.each([1,2,4,7,8,11])('returns %j unchanged', input => {
expect(fizzbuzz(input)).toEqual(input)
})
})
describe('numbers that are multiples of 3 but not 5', () => {
it.each([3,6,9,12,18,21,24,27,33])('returns Fizz for %j', input => {
expect(fizzbuzz(input)).toEqual('Fizz')
})
})
describe('numbers that are multiples of 5 but not 3', () => {
it.each([5,10,20,25,35,40,50])('returns Buzz for %j', input => {
expect(fizzbuzz(input)).toEqual('Buzz')
})
})
describe('numbers that are multiples of 3 and 5', () => {
it.each([15,30,45,60,75])('returns FizzBuzz for %j', input => {
expect(fizzbuzz(input)).toEqual('FizzBuzz')
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment