Project Personal Library

Project Personal Library
0

#1

This is really problem for me. I cannot decipher how to send a post. it ‘s expect book object’ and the object is{}
if book {book:‘title’} I send both This is the last problem in this project https://candle-trowel.glitch.me/

test('Test POST /api/books with title', function(done) {
       chai.request(server)
      .post('/api/books')
      .send({book:title,title:title})          
      .end(function(err, res){
         console.log('with title'+JSON.stringify(res.body))
        assert.equal(res.status, 200);
       // assert.isArray(res.body, 'response should be an array');
     
       assert.property(res.body[0], '_id', 'Books in array should contain _id');        
        done();
      });

Solved


#2

I think it should probably be

.send({title: "my book"})

At the moment, you aren’t sending just the title, and you’re sending a variable called “title” rather than an actual value.