var request = require('supertest');
var requestModule = require('request');
var expect = require('chai').expect;

require('./setup.js');
var db = require('./../../server/config/db');
var appUrl = process.env.PROTOCOL + process.env.HOST + ':' + process.env.PORT;

request = request(appUrl);

describe('Express Server', function() {

  describe('Basic GET request', function() {
    it('returns 302 statusCode for redirection', function(done) {
      request.get('/').expect(302)
      .end(function(err) {
        if (err) return done(err);
        done();
      })
    })
  })

  describe('Authentication', function() {
    beforeEach(function() {
      // Logout the user before each authentication test
      request.get('/logout', function(err, res, body) {});
    });
    describe('Privileged Access', function() {
      it('redirects to welcome page when an unauthenticated user tries to access the main page', function(done) {
        request.get('/')
          .expect(302)
          .expect('Location', '/welcome')
          .end(function(err) {
            if (err) return done(err);
            done();
          });
      });
    });
  })

  // describe 'User authentication', ->
  //   describe 'POST /sessions', ->
  //     describe 'success', ->
  //       it 'redirects to the right path', (done) ->
  //         request
  //           .post(/login)
  //           .send('')
  //           .end(done)

});
@@ -33,48 +33,8 @@
 ');%0A
-var requestModule = require('request');%0A
 var 
@@ -1098,20 +1098,370 @@
     %7D);%0A
-  %7D)
+%0A    describe('User signup and login', function() %7B%0A      it('Signup a new user', function(done) %7B%0A        done();%0A      %7D);%0A      it('Login with the same username and password combination', function(done) %7B%0A        done();%0A      %7D);%0A    %7D);%0A%0A  %7D);%0A%0A  describe('Saving sessions', function() %7B%0A%0A  %7D);%0A%0A  describe('Saving snapshots', function() %7B%0A%0A  %7D);%0A%0A%0A
 %0A%0A  // d

Add further testing structure for auth and session API calls