Skip to main content

should update recipe on PUT

it('should update recipe on PUT', function() {
          const updateRecipe = {
              name: 'chocolate milk',
              ingredients: ['cocoa', 'milk', 'sugar']
          }; //const updateRecipe
          return chai.request(app)
              .get('/recipes')
              .then(function(res) {
                  updateRecipe.id = res.body[0].id;
                  return chai.request(app)
                      .put(`/recipes/${updateRecipe.id}`)
                      .send(updateRecipe);
              }) //.then function (updateRecipe)

              .then(function(res) {
                  res.should.have.status(200);
                  res.should.be.json;
                  res.body.should.be.a('object');
                  res.body.should.deep.equal(updateRecipe);
              }); //.then function (status 200)
      }); //it(should update recipe on PUT)