Skip to content

Commit

Permalink
update existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaniyaps committed Jun 28, 2024
1 parent 7db0131 commit 7075738
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions client/src/components/home-page/Todo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function Todo({ todo, connectionId }: Props) {
</p>
<div className="flex gap-2 grow justify-end opacity-0 group-hover:opacity-100 transition-opacity">
<Button
title={data.completed ? "mark as incomplete" : "mark as complete"}
size={"icon"}
variant={"ghost"}
disabled={isToggleCompletedMutationInFlight}
Expand All @@ -78,6 +79,7 @@ export default function Todo({ todo, connectionId }: Props) {
)}
</Button>
<Button
title="delete todo"
size={"icon"}
variant={"ghost"}
disabled={isDeleteMutationInFlight}
Expand Down
1 change: 0 additions & 1 deletion client/src/components/home-page/TodoController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export default function TodoController({ rootQuery }: Props) {
const onSubmit: SubmitHandler<z.infer<typeof createTodoSchema>> = async (
input
) => {
console.log(data.todos.__id);
form.reset();
commitMutation({
variables: { content: input.content, connections: [data.todos.__id] },
Expand Down
15 changes: 13 additions & 2 deletions server/tests/unit/todos/test_repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ async def test_get_all_todos(todo_repo: TodoRepo) -> None:


async def test_delete_todo(todo: Todo, todo_repo: TodoRepo) -> None:
"""Ensure we can delete a todo by ID."""
await todo_repo.delete(todo_id=todo.id)
"""Ensure we can delete a todo."""
await todo_repo.delete(todo=todo)
assert await todo_repo.get(todo_id=todo.id) is None


async def test_update_todo(todo: Todo, todo_repo: TodoRepo) -> None:
"""Ensure we can update a todo."""
# mark todo as complete
await todo_repo.update(todo=todo, completed=True)
assert todo.completed

# mark todo as incomplete
await todo_repo.update(todo=todo, completed=False)
assert not todo.completed

0 comments on commit 7075738

Please sign in to comment.