I'm hiring a unit testing engineer to help write unit tests for our Vue.js/TypeScript project management web app. Write a simple take-home coding assignment that would test their skills.
Assistant
Sure! Here is a simple take-home coding assignment that you could use to test a unit testing engineer's skills:
Assignment
You are given a simple Vue.js/TypeScript project management web app that allows users to create, edit, and delete project tasks. The app has the following components:
Task: represents a single task, with a title and a description.
TaskList: displays a list of tasks, and allows the user to add, edit, and delete tasks.
TaskForm: a form for creating and editing tasks.
Your task is to write unit tests for these components using the Jest testing framework.
You should write tests for the following scenarios:
Adding a new task:
Given a task form with valid input, when the user submits the form, a new task should be added to the task list.
Given a task form with invalid input (e.g. an empty task title), when the user submits the form, a new task should not be added to the task list.
Editing a task:
Given a task form with valid input, when the user submits the form, the selected task should be updated in the task list.
Given a task form with invalid input (e.g. an empty task title), when the user submits the form, the selected task should not be updated in the task list.
Deleting a task:
Given a task in the task list, when the user clicks the delete button, the task should be removed from the task list.
Your tests should cover both the expected behavior of the components (e.g. a new task is added to the task list when the form is submitted) and the edge cases (e.g. the form should not allow the user to submit an empty task title).
You should use the Vue Test Utils library to mount the components and interact with them in your tests.
Submission
Please submit your solution as a zip file containing the following:
The modified source code of the project, including your tests.
A README file explaining how to run your tests and any assumptions or design choices you made while writing the tests.
Evaluation Criteria
Your solution will be evaluated based on the following criteria:
Correctness: Does your solution correctly test the expected behavior and edge cases of the components?
Code quality: Is the code clean, well-structured, and easy to understand?
Test coverage: Does your solution have good test coverage, including both positive and negative test cases?
Note
This is just a simple example and you may need to adjust it to better fit the needs and requirements of your specific project.