Skip to content

Instantly share code, notes, and snippets.

@al-the-x
Created February 5, 2015 16:14
Show Gist options
  • Save al-the-x/2d550a36e02350eeebd0 to your computer and use it in GitHub Desktop.
Save al-the-x/2d550a36e02350eeebd0 to your computer and use it in GitHub Desktop.
var todoList = [
{ 'completed': false, 'name': 'thing 1' },
{ 'completed': true, 'name': 'thing 2' },
]
function addTaskToList(list, task){
// Add `task` to `list`
list.push(task);
}
function removeTaskFromList(list, task){
// Remove `task` from `list`...
// 0. enumerate steps to remove something...
}
function strikeoutTaskOnList(list, task){
// "Strikeout" `task` on `list`...
}
/** -- Start Testing here... -- **/
assert.deepEqual(todoList, [
"thing 1",
"thing 2",
]);
var thing1 = todoList[0];
// Mark "thing 1" as "completed"...
thing1.completed = true;
addTaskToList(todoList, 'thing 3');
assert.deepEqual(todoList, [
"thing 1",
"thing 2",
"thing 3",
]);
strikeoutTaskOnList(todoList, 'thing 2');
assert.deepEqual(todoList, [
"thing 1",
"thing 2",
"thing 3",
]);
removeTaskFromList(todoList, 'thing 2');
assert.deepEqual(todoList, [
"thing 1",
"thing 3",
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment