Created
July 14, 2017 06:15
-
-
Save ryanivandsouza/23a459eb3bdc8e5c96c8e0d7268e7c39 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/nopabe
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> | |
<script src="https://wzrd.in/standalone/expect@latest"></script> | |
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
const toggleTodo = (todo) => { | |
return Object.assign({}, todo, { | |
completed: !todo.completed | |
}) | |
} | |
const testToggleTodo = () => { | |
const todoBefore = { | |
id: 0, | |
text: 'Learn Redux', | |
completed: false | |
} | |
const todoAfter = { | |
id: 0, | |
text: 'Learn Redux', | |
completed: true | |
} | |
deepFreeze(todoBefore) | |
expect( | |
toggleTodo(todoBefore) | |
).toEqual(todoAfter) | |
} | |
testToggleTodo() | |
console.log('All tests passed!') | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const toggleTodo = (todo) => { | |
return Object.assign({}, todo, { | |
completed: !todo.completed | |
}) | |
} | |
const testToggleTodo = () => { | |
const todoBefore = { | |
id: 0, | |
text: 'Learn Redux', | |
completed: false | |
} | |
const todoAfter = { | |
id: 0, | |
text: 'Learn Redux', | |
completed: true | |
} | |
deepFreeze(todoBefore) | |
expect( | |
toggleTodo(todoBefore) | |
).toEqual(todoAfter) | |
} | |
testToggleTodo() | |
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
const toggleTodo = (todo) => { | |
return Object.assign({}, todo, { | |
completed: !todo.completed | |
}) | |
} | |
const testToggleTodo = () => { | |
const todoBefore = { | |
id: 0, | |
text: 'Learn Redux', | |
completed: false | |
} | |
const todoAfter = { | |
id: 0, | |
text: 'Learn Redux', | |
completed: true | |
} | |
deepFreeze(todoBefore) | |
expect( | |
toggleTodo(todoBefore) | |
).toEqual(todoAfter) | |
} | |
testToggleTodo() | |
console.log('All tests passed!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment