Adding Tests to Your Portfolio Project: The 5 Tests That Prove You Write Production Code
An engineering manager reviewing entry-level portfolios has an internal rubric that they never articulate but apply consistently. One of the questions on that rubric is: "Does this project have tests?" If the answer is yes, the manager mentally upgrades the candidate from "wrote some code" to "wrote code that is verifiably correct." The upgrade is significant because it signals that the candidate has been exposed to professional development practices — automated testing, continuous integration, code quality as a discipline rather than an afterthought. If the answer is no, the manager moves on without penalty, but also without the upgrade. The candidate remains in the "wrote some code" bucket, competing against every other untested portfolio in the pile. Five tests is all it takes to earn the upgrade.
You do not need 100% test coverage. You do not need end-to-end tests that spin up browsers. You need five tests that demonstrate you understand the testing pyramid: 2 unit tests for business logic (happy path + edge case), 1 integration test for your database layer, 1 API test for your most important endpoint, and 1 test that verifies error handling produces the correct response. These five tests cover the categories that interviewers actually care about: correctness, edge-case awareness, database verification, and error-path handling. Write them this weekend. Add a "Tests" badge to your README showing passing status.
Test 1 & 2: Happy Path and Edge Case Unit Tests
Pick one function in your application that contains business logic — a validation function, a calculation function, a data transformation. Write two tests for it. Test 1: provide valid input and assert the correct output (happy path). Test 2: provide invalid, empty, or boundary input and assert the correct error handling (edge case). Example: if you have a function that validates email addresses, test 1 passes "user@domain.com" and expects true. Test 2 passes "", null, "notanemail", and "user@" and expects false with a specific error message. These two tests demonstrate that you think about both expected and unexpected inputs, which is the foundation of defensive programming.
Test 3: Database Integration Test
Write a test that inserts a record into your database, reads it back, and asserts the data matches. This test verifies that your database connection works, your schema is correct, and your ORM or query builder produces valid SQL. Use a test database (not your production database). Spin it up before the test suite runs, run migrations, seed test data, run tests, and tear it down after. This is the pattern that professional test suites use, and demonstrating it in a student project is a strong signal.
Test 4: API Endpoint Test
Write a test that sends an HTTP request to your most important API endpoint and asserts the response status code and body shape. Use Supertest (Node.js) or a similar library that can send requests to your Express/Fastify server without actually starting it on a port. Test both a successful request (200 with correct body) and an error request (400 or 404 with error message). This test proves your API routes work end-to-end, from HTTP parsing through route handling to response serialization.
Test 5: Error Handling Test
Write a test that triggers an error condition (invalid authentication token, missing required field, database connection failure) and asserts that the response is a proper error object with the correct HTTP status code and a descriptive message. This test proves that your application fails gracefully instead of crashing with an unhandled exception, which is the #1 production reliability problem in junior-written code.
Install Jest or Vitest. Write the five tests above against your existing project. Configure a test script in package.json. Run the tests. If they pass, add a GitHub Actions workflow that runs them on every push. Add a status badge to your README. Total time: one weekend. Recruiter signal: transforms from "wrote some code" to "wrote code that is verifiably correct, with CI." That is the upgrade that gets interviews.