Back to articles
How I Added Unit Tests to a Next.js Project Using Vitest (and Why It Matters for Portfolio Projects)

How I Added Unit Tests to a Next.js Project Using Vitest (and Why It Matters for Portfolio Projects)

via Dev.toDavid

I recently built a SQL and Python interview prep app using Next.js, TypeScript, Supabase, and Vercel, with ChatGPT for code assist. The core of the app is a custom SQL answer checker — a function that evaluates whether a user's SQL query contains the right keywords, avoids forbidden patterns, and selects the right columns. The SQL warmup-questions.ts file contains the promptText and expectedIncludes for each question: export type WarmupQuestion = { slug : string ; title : string ; promptText : string ; expectedIncludes : string []; }; export const SQL_WARMUP_QUESTIONS : WarmupQuestion [] = [ { slug : " basic-select " , title : " Basic SELECT " , promptText : " Write a SQL query that returns the name and age columns from the users table. " , expectedIncludes : [ " select " , " name " , " age " , " from users " ], }, { slug : " where-filter " , title : " WHERE Filter " , promptText : " Write a SQL query that returns all users whose age is greater than or equal to 18. " , expectedIncludes

Continue reading on Dev.to

Opens in a new tab

Read Full Article
6 views

Related Articles