Skip to content

Commit

Permalink
More clears
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinND committed Jun 27, 2014
1 parent 3dad37e commit 0f88e18
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 417 deletions.
9 changes: 7 additions & 2 deletions lib/mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ module.exports = function addMappings(Anyfetch) {
r = r.send(body);
}

r.expect(config.expectedStatus)
.end(cb);
r.expect(function(res) {
// TODO: remove this
if(config.expectedStatus !== res.statusCode) {
console.log(res.body);
return new Error('Expected ' + config.expectedStatus + ', got ' + res.statusCode);
}
}).end(cb);
};
};

Expand Down
8 changes: 8 additions & 0 deletions test/mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ var AnyFetch = require('../lib/index.js');
var configuration = require('../config/configuration.js');
var isFunction = require('../lib/helpers/is-function.js');
var extendDefaults = require('../lib/helpers/extend-defaults.js');

var makeResetFunction = require('./helpers/reset.js');
var clearSubcompanies = require('../script/clear-subcompanies.js');
var clearUsers = require('../script/clear-users.js');

describe('<Low-level mapping functions>', function() {
var anyfetch = new AnyFetch(configuration.test.login, configuration.test.password);
Expand Down Expand Up @@ -220,6 +223,7 @@ describe('<Low-level mapping functions>', function() {
};
describe('postUser', function() {
before(cleaner);
before(clearUsers);

var userId = null;

Expand All @@ -236,6 +240,10 @@ describe('<Low-level mapping functions>', function() {
});

describe('subcompanies', function() {
before(cleaner);
before(clearSubcompanies);
before(clearUsers);

var companyInfos = {
name: 'the-fake-company'
};
Expand Down
Loading

0 comments on commit 0f88e18

Please sign in to comment.