Created
October 5, 2016 04:24
-
-
Save anonymous/02bfb7c5b254c788ebddccd2a601090a to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/likewi
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script src="https://unpkg.com/expect/umd/expect.min.js"></script> | |
<script id="jsbin-javascript"> | |
console.log('Starting testing with expect'); | |
function add(a, b){ | |
return a + b | |
} | |
expect(add(3,5)).toBe(8, ["it works"]) | |
function capWord(word){ | |
if(!word || typeof word !== 'string'){ | |
word = '' | |
} | |
return word.charAt(0).toUpperCase() + word.slice(1) | |
} | |
expect(capWord('dani')).toBe('Dani') | |
expect(capWord('dani')).toBeA('string') | |
expect(capWord()).toBe('') | |
function capitalizeWord (word) { | |
if (!word || typeof word !== 'string') { | |
word = ''; | |
} | |
return word.charAt(0).toUpperCase() + word.slice(1); | |
} | |
expect(capitalizeWord('dani')).toBe('Dani') | |
expect(capitalizeWord('andrew')).toBeA('string'); | |
// Given nothing expect '' | |
expect(capitalizeWord()).toBe(''); | |
console.log('All tests passed!') | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">console.log('Starting testing with expect'); | |
function add(a, b){ | |
return a + b | |
} | |
expect(add(3,5)).toBe(8, ["it works"]) | |
function capWord(word){ | |
if(!word || typeof word !== 'string'){ | |
word = '' | |
} | |
return word.charAt(0).toUpperCase() + word.slice(1) | |
} | |
expect(capWord('dani')).toBe('Dani') | |
expect(capWord('dani')).toBeA('string') | |
expect(capWord()).toBe('') | |
function capitalizeWord (word) { | |
if (!word || typeof word !== 'string') { | |
word = ''; | |
} | |
return word.charAt(0).toUpperCase() + word.slice(1); | |
} | |
expect(capitalizeWord('dani')).toBe('Dani') | |
expect(capitalizeWord('andrew')).toBeA('string'); | |
// Given nothing expect '' | |
expect(capitalizeWord()).toBe(''); | |
console.log('All tests passed!')</script></body> | |
</html> |
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
console.log('Starting testing with expect'); | |
function add(a, b){ | |
return a + b | |
} | |
expect(add(3,5)).toBe(8, ["it works"]) | |
function capWord(word){ | |
if(!word || typeof word !== 'string'){ | |
word = '' | |
} | |
return word.charAt(0).toUpperCase() + word.slice(1) | |
} | |
expect(capWord('dani')).toBe('Dani') | |
expect(capWord('dani')).toBeA('string') | |
expect(capWord()).toBe('') | |
function capitalizeWord (word) { | |
if (!word || typeof word !== 'string') { | |
word = ''; | |
} | |
return word.charAt(0).toUpperCase() + word.slice(1); | |
} | |
expect(capitalizeWord('dani')).toBe('Dani') | |
expect(capitalizeWord('andrew')).toBeA('string'); | |
// Given nothing expect '' | |
expect(capitalizeWord()).toBe(''); | |
console.log('All tests passed!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment