Skip to content

Instantly share code, notes, and snippets.

@delacruz-dev
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delacruz-dev/188830bec2e430daed08 to your computer and use it in GitHub Desktop.
Save delacruz-dev/188830bec2e430daed08 to your computer and use it in GitHub Desktop.
import expect from 'expect';
import {isMultipleOfFive, getMultiplesOfFive, getSumOfMultiples, sum} from '../src'
describe('Given a number', function(){
it('return true if it is a multiple of 5', function(){
expect(isMultipleOfFive(5)).toBe(true);
expect(isMultipleOfFive(10)).toBe(true);
expect(isMultipleOfFive(1)).toBe(false);
expect(isMultipleOfFive(9)).toBe(false);
});
});
describe('Given two numbers', function(){
it('Gets all the multiples of five between them', function(){
expect(getMultiplesOfFive(1, 5)).toInclude(5);
expect(getMultiplesOfFive(1, 10)).toInclude(5).toInclude(10);
});
it('Gets the sum of both numbers', function() {
expect(sum(1, 1)).toBe(2);
expect(sum(5, 10)).toBe(15);
});
it('Gets the sum of all the multiples of five between them', function(){
expect(getSumOfMultiples(1, 5)).toBe(5);
expect(getSumOfMultiples(1, 10)).toBe(15);
expect(getSumOfMultiples(1, 20)).toBe(50);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment