~/talk

Supercharge your Tests with Factories

Talkat Prisma Day 2021 · 2021-06-29..06-30· [testing, databases]
slides:none on file

Factories plus Prisma and TypeScript cut test setup down to reusable build/create factory functions that call Prisma client, use a faker (chance) for randomized defaults, and expose a createFactory abstraction to infer required fields. Tests use a truncated resetDB, Jest runInBand, inline snapshots for error assertions, and Cypress tasks that invoke the same factories from the browser tests. Result: fewer brittle fixtures, one-place updates when a required column appears, higher request and E2E coverage used successfully at Echobind and discussed on GitHub.

AI-written summary · about

  1. 0:00Introduction to test factories
  2. 1:16Request tests with live database
  3. 5:33Factory pattern with Prisma
  4. 11:32End-to-end tests with Cypress
  5. 14:49Tips and tricks for factories
  6. 15:30Closing and resources
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.