sinon is used to test spies, stubs, and mocks for JavaScript tests. To learn about these, let's move on to the movie rating application we have in our controller file, controller/movies.js:
const Movie = require("../models/Movie");
const passport = require("passport");
module.exports.controller = (app) => {
// fetch all movies
app.get("/movies", function(req, res) {
Movie.find({}, 'name description release_year genre', function
(error, movies) {
if (error) { console.log(error); }
res.send({
movies: movies
})
})
})
// add a new movie
app.post('/movies', (req, res) => {
const movie = new Movie({
name: req.body.name,
description: req.body.description,
release_year: req.body.release_year,
genre: req.body.genre
})
movie.save(function (error...