Subject: Take-Home Coding Assignment for Unit Testing Engineer Position
Dear Candidate,
We are excited to have you participate in our take-home coding assignment for the Unit Testing Engineer position. This assignment will help us evaluate your skills in writing unit tests for a TypeScript project management web app.
Assignment Overview:
Our company is developing a scientific project management SaaS product called "SciProMan." The application is built using TypeScript, React, and Node.js. Your task is to write unit tests for a specific feature of the application.
Feature Description:
The feature you will be testing is the "Experiment Tracker," which allows users to create, update, and delete experiments. Each experiment has the following properties:
id (string): A unique identifier for the experiment.
name (string): The name of the experiment.
description (string): A brief description of the experiment.
startDate (Date): The date the experiment was started.
endDate (Date): The date the experiment was completed.
status (string): The current status of the experiment (e.g., "In Progress," "Completed," or "Canceled").
Assignment Tasks:
-
Write unit tests for the following functions in the Experiment Tracker feature:
a. createExperiment(name: string, description: string): Promise<Experiment>
b. updateExperiment(id: string, name: string, description: string, status: string): Promise<Experiment>
c. deleteExperiment(id: string): Promise<void>
d. getExperimentById(id: string): Promise<Experiment>
e. getAllExperiments(): Promise<Experiment[]>
-
Ensure that your tests cover various scenarios, including:
a. Valid input
b. Invalid input (e.g., empty strings, invalid dates, non-existent IDs)
c. Edge cases (e.g., maximum and minimum values for dates, long strings)
-
Use a testing framework of your choice (e.g., Jest, Mocha, or Jasmine) and a mocking library (e.g., Sinon or Jest mocks) to isolate the functions being tested.
-
Write clear and concise test descriptions that accurately reflect the purpose of each test.
-
Ensure that your tests are easy to understand, maintain, and extend.
Submission Guidelines:
Please submit your completed assignment as a zip file containing your TypeScript test files and a README file with instructions on how to run your tests. Additionally, include a brief explanation of your testing approach and any design decisions you made while writing your tests.
Evaluation Criteria:
Your submission will be evaluated based on the following criteria:
- Test coverage: The extent to which your tests cover the required functionality and edge cases.
- Test quality: The clarity, maintainability, and extensibility of your tests.
- Test design: Your ability to isolate the functions being tested and use appropriate testing and mocking techniques.
- README and explanation: The clarity and completeness of your submission's documentation and your explanation of your testing approach.
We look forward to reviewing your submission and learning more about your unit testing skills. If you have any questions, please don't hesitate to contact us.
Best regards,
[Your Name]
[Your Position]
[Your Company]