text: 'use strict';
  var chai = require('chai');
  var request = require('request');
  
  chai.should();
  
  require('dotenv').load();
  
  describe('/user', function() {
    describe('get', function() {
      it('should respond with 200 OK', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          method: 'GET',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + process.env.OAUTH
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(200);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
      it('should respond with 400 NOT OK', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          method: 'GET',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + process.env.OAUTH
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(400);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
      it('should respond with 500 SERVER ERROR', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          method: 'GET',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + process.env.OAUTH
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(500);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
    });
  
    describe('post', function() {
      it('should respond with 200 OK', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          qs: {
            longitude: 'DATA GOES HERE'
          },
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Basic ' + process.env.BASIC_AUTH
          },
          body: {
            latitude: 'DATA GOES HERE'
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(200);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
      it('should respond with 400 NOT OK', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          qs: {
            longitude: 'DATA GOES HERE'
          },
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Basic ' + process.env.BASIC_AUTH
          },
          body: {
            latitude: 'DATA GOES HERE'
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(400);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
      it('should respond with 500 SERVER ERROR', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          qs: {
            longitude: 'DATA GOES HERE'
          },
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Basic ' + process.env.BASIC_AUTH
          },
          body: {
            latitude: 'DATA GOES HERE'
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(500);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
    });
  
    describe('put', function() {
      it('should respond with 200 OK', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          qs: {
            longitude: 'DATA GOES HERE'
          },
          method: 'PUT',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + process.env.OAUTH
          },
          body: {
            latitude: 'DATA GOES HERE'
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(200);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
      it('should respond with 400 NOT OK', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          qs: {
            longitude: 'DATA GOES HERE'
          },
          method: 'PUT',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + process.env.OAUTH
          },
          body: {
            latitude: 'DATA GOES HERE'
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(400);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
      it('should respond with 500 SERVER ERROR', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          qs: {
            longitude: 'DATA GOES HERE'
          },
          method: 'PUT',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + process.env.OAUTH
          },
          body: {
            latitude: 'DATA GOES HERE'
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(500);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
    });
  
    describe('patch', function() {
      it('should respond with 200 OK', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          method: 'PATCH',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + process.env.OAUTH
          },
          body: {
            latitude: 'DATA GOES HERE'
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(200);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
    });
  
    describe('delete', function() {
      it('should respond with 200 OK', function(done) {
        request({
          url: 'https://api.uber.com/user',
          json: true,
          method: 'DELETE',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Basic ' + process.env.BASIC_AUTH
          }
        },
        function(error, res, body) {
          if (error) return done(error);
  
          res.statusCode.should.equal(200);
  
          body.should.equal(null); // non-json response or no schema
          done();
        });
      });
  
    });
  
  });
  