Welcome to the Hurudzai AI technical assessment! This project is a miniaturized version of an enquiry management system. It contains intentional bugs, sub-optimal code, and missing features to simulate a real-world "legacy" codebase that needs improvement.
⏱️ Recommended Time: 1-2 hours 💬 Questions? Reach out to your contact person or open an issue on your fork.
To begin the assessment, you must follow these steps to ensure your work is tracked correctly:
- Fork this Repository: Click the Fork button at the top-right of this GitHub page. This creates a copy of the project in your own GitHub account.
- Clone Your Fork:
git clone https://github.com/YOUR_USERNAME/interview-enquiry-system.git cd interview-enquiry-system - Create a New Branch:
git checkout -b feature/interview-solution
- Install Dependencies:
npm install
- Run Initial Tests:
(Expect 2 failing tests initially!)
npm test
Your mission is divided into three parts. We recommend making incremental commits for each step.
Run the test suite and fix the underlying logic in lib/enquiryManager.ts:
- Email Validation: The current regex is overly restrictive and fails for valid formats like
user.name@domain.technology. - Persistence: The
createEnquiryfunction fails to save new entries to the in-memory array.
Add a new function searchEnquiriesByEmail(email: string) to the EnquiryManager:
- It must return an array of all enquiries matching the provided email.
- Requirement: Support partial matches (e.g., searching "jane" should find "jane@test.org").
- Requirement: Must be case-insensitive.
- Add at least one new test case in
tests/enquiry.test.tsto verify your new search feature works as expected. - Ensure all tests pass (
npm test).
After completing the code, please answer the following questions in a new file named ANSWERS.md or at the bottom of the README.
- Architecture: If we were to transition this from an in-memory array to a real database (like PostgreSQL or MongoDB), what changes would you make to the
EnquiryManagerarchitecture? - Security: What are some potential security risks in the current
createEnquiryimplementation? - Refactoring: Beyond the bugs you fixed, what is one major refactoring you would perform on
lib/enquiryManager.tsto make it production-ready?
We aren't just looking for the right answer—we're looking at your process:
- Git Hygiene: Clear, descriptive commit messages.
- Reading Comprehension: Did you meet all the search feature requirements?
- Code Quality: Usage of modern TypeScript, clean logic, and avoiding
anywhere possible. - Testing: Do your tests cover edge cases?
- Push your changes to your fork:
git push origin feature/interview-solution
- Create a Pull Request: Submit a PR from your branch back to the
mainbranch of your fork. - Share the Link: Send the link to your fork (or the PR link) back to your recruiter.
Good luck! We are excited to see your solution. 🚀