'use strict';

var request = require('supertest');
var should = require('should');
var async = require('async');

var app = require('../app.js');
var config = require('../config/configuration.js');


describe('POST /hydrate API endpoint', function() {
  it('should refuse every request without a file', function(done) {
    request(app).post('/hydrate')
      .expect(405)
      .end(done);
  });

  it('should accept request with a file attached', function(done) {
    request(app).post('/hydrate')
      .attach('file', __filename)
      .expect(200)
      .end(function(err, res) {
        done();
      });
  });

  it('should respond with the correct informations', function(done) {
    request(app).post('/hydrate')
      .attach('file', __filename)
      .expect('Content-Type', /json/)
      .expect(200)
      .end(function(err, res) {

      res.body.should.have.property('raw');
      res.body.should.have.property('html');
      res.body.should.have.property('content-encoding');

      done();
    });
  });
});

@@ -192,17 +192,16 @@
 .js');%0A%0A
-%0A
 describe
@@ -268,14 +268,8 @@
 use 
-every 
 requ
@@ -280,22 +280,25 @@
 without 
-a file
+metadatas
 ', funct
@@ -339,24 +339,78 @@
 '/hydrate')%0A
+      .send(%7B'file_path': 'http://example.org/file'%7D)%0A
       .expec
@@ -458,14 +458,14 @@
 uld 
-accept
+refuse
  req
@@ -477,24 +477,21 @@
 with
- a
+out
  file
- attached
+_path
 ', f
@@ -551,33 +551,53 @@
    .
-attach('file', __filename
+send(%7B'metadatas': 'http://example.org/file'%7D
 )%0A  
@@ -600,35 +600,35 @@
 )%0A      .expect(
-200
+405
 )%0A      .end(fun
@@ -628,52 +628,270 @@
 end(
-function(err, res) %7B%0A        done();%0A      %7D
+done);%0A  %7D);%0A%0A  it('should immediately return 204', function(done) %7B%0A    this.timeout(500);%0A    request(app)%0A      .post('/hydrate')%0A      .send(%7B%0A        'metadatas': %7B%7D,%0A        'file_path': 'http://example.org/file'%0A      %7D)%0A      .expect(204)%0A      .end(done
 );%0A 

Refactor tests