const chai = require('chai');
const expect = chai.expect;
const chaiHttp = require('chai-http');
chai.use(chaiHttp);
const mongoose = require('mongoose');
const request = chai.request;
const Pf = require(__dirname + '/../model/pf');
const port = process.env.PORT = 1234;
process.env.MONGO_URI = 'mongodb://localhost/pf_test_db';
const Server = require(__dirname + '/../lib/server');
const route = require(__dirname + '/../routes/PF_router');

describe('Server Tests!', () => {
  it('should accept GET requests to /api/pf', (done) => {
    request('localhost:' + port)
      .get('/api/pf')
      .end((err, res) => {
        expect(err).to.eql(null);
        expect(res).to.have.status(200);
        expect(res.text).to.include('Here are all the family members');
        done();
      });
  });
  // it('should accept a name', (done) => {
  //   request('localhost:' + port)
  //   .get('/api/pf')
  //   .end((err, res) => {
  //     expect(err).to.eql(null);
  //     expect(res.text).to.eql('Hello, maverick!\n');
  //     done();
  //   });
  // });
  it('should do a POST method', (done) => {
    after((done) => {
      mongoose.connection.db.dropDatabase(() => {
        done();
      });
    });
    Server.inject({
      url: '/api/put',
      method: 'POST',
      payload: {
        name: 'Ranger Rick'
      }
    }, (res) => {
      expect(res.payload).to.include('Ranger Rick');
    })
    done();
  });
  describe('routes that need to be a Patridge Family member in the DB', () => {
    beforeEach((done) => {
      var newPf = new Pf({
        name: 'testshoe',
      });
      newPf.save((err, data) => {
        if (err) return;
        this.pf = data;
        done();
      });
    });
    afterEach((done) => {
      this.pf.remove((err) => {
        if (err) return;
        done();
      });
    });
    after((done) => {
      mongoose.connection.db.dropDatabase(() => {
        done();
      });
    });
    it('should do a DELETE method', (done) => {
      request('localhost:' + port)
        .delete('/api/delete/' + this.pf._id)
        .end((err, res) => {
          expect(err).to.eql(null);
          expect(res.text).to.eql('You\re outta the family!');
          done();
        });
    });
  });
});

@@ -1918,24 +1918,372 @@
 %7D);%0A    %7D);%0A
+    it('should change the family member%5C's name a PUT request', (done) =%3E %7B%0A  request('localhost:' + port)%0A    .put('/api/put/' + this.pf._id)%0A    .send(%7B%0A      name: 'sketchers',%0A    %7D)%0A    .end((err, res) =%3E %7B%0A      expect(err).to.eql(null);%0A      expect(res.text).to.include('stays in the family for another season!');%0A      done();%0A    %7D);%0A%7D);%0A
     it('shou

PUT test