Skip to content

Instantly share code, notes, and snippets.

Created October 5, 2016 04:24
Show Gist options
  • Save anonymous/02bfb7c5b254c788ebddccd2a601090a to your computer and use it in GitHub Desktop.
Save anonymous/02bfb7c5b254c788ebddccd2a601090a to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/likewi
<!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>
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