---
type: video
yt_id: VVU2YVRMdUlfajQtMHdpRFN6bWFQY3RRLklEakY2LXMxaEdr
videoId: IDjF6-s1hGk
title: "Mocking a Database in Node with Jest"
date: "2021-04-06T17:13:28Z"
slug: "mocking-a-database-in-node-with-jest"
image: 
  name: "mocking-a-database-in-node-with-jest.jpg"
  alt: "Mocking a Database in Node with Jest"
  width: 1280
  height: 720
status: 'published'
description: "Learn how to use jest mock functions to mock a database in an HTTP server. "
tags: ['JavaScript', 'js', 'database', 'automated test', 'tdd', 'test driven development', 'automated test']
previousPostSlug: 'mocking-a-database-with-jest-in-javascript'
nextPostSlug: "prisma-and-nextjs-video"
---

Learn how to use jest mock functions to mock a database in an HTTP server. 

Other Testing Videos:

* Introduction to Writing Automated Tests With Jest: [https://youtu.be/hz0_q1MJa2k](https://youtu.be/hz0_q1MJa2k)
* Introduction to TDD in JavaScript: [https://youtu.be/89Pl2Uok8xc](https://youtu.be/89Pl2Uok8xc)
* Testing Node Server with Jest and Supertest: [https://youtu.be/FKnzS_icp20](https://youtu.be/FKnzS_icp20)
* Dependency Injection: [https://youtu.be/yOC0e0NMZ-E](https://youtu.be/yOC0e0NMZ-E)

🔗 Code:
[https://github.com/Sam-Meech-Ward/express_jest_and_mocks](https://github.com/Sam-Meech-Ward/express_jest_and_mocks)

🔗 Jest Mock Functions:
[https://jestjs.io/docs/mock-functions](https://jestjs.io/docs/mock-functions)

