test: add debug logs

Add debug logs to troubleshoot two unit tests failing
on the CI server only.
This commit is contained in:
Miroslav Bajtoš 2014-06-06 14:51:13 +02:00
parent 7d674779e1
commit f0ff40d3f7
2 changed files with 13 additions and 1 deletions

View File

@ -6,6 +6,7 @@ var app = require(path.join(ACCESS_CONTROL_APP, 'app.js'));
var assert = require('assert');
var USER = {email: 'test@test.test', password: 'test'};
var CURRENT_USER = {email: 'current@test.test', password: 'test'};
var debug = require('debug')('loopback:test:access-control.integration');
describe('access control - integration', function () {
@ -99,6 +100,10 @@ describe('access control - integration', function () {
lt.describe.whenCalledRemotely('GET', '/api/users/:id', function() {
lt.it.shouldBeAllowed();
it('should not include a password', function() {
debug('GET /api/users/:id response: %s\nheaders: %j\nbody string: %s',
this.res.statusCode,
this.res.headers,
this.res.text);
var user = this.res.body;
assert.equal(user.password, undefined);
});

View File

@ -5,6 +5,7 @@ var SIMPLE_APP = path.join(__dirname, 'fixtures', 'simple-integration-app');
var app = require(path.join(SIMPLE_APP, 'app.js'));
var assert = require('assert');
var expect = require('chai').expect;
var debug = require('debug')('loopback:test:relations.integration');
describe('relations - integration', function () {
@ -28,13 +29,19 @@ describe('relations - integration', function () {
this.url = '/api/stores/' + this.store.id + '/widgets';
});
lt.describe.whenCalledRemotely('GET', '/api/stores/:id/widgets', function() {
it('should succeed with statusCode 200', function() {
assert.equal(this.res.statusCode, 200);
});
describe('widgets (response.body)', function() {
beforeEach(function() {
debug('GET /api/stores/:id/widgets response: %s' +
'\nheaders: %j\nbody string: %s',
this.res.statusCode,
this.res.headers,
this.res.text);
this.widgets = this.res.body;
this.widget = this.res.body[0];
this.widget = this.res.body && this.res.body[0];
});
it('should be an array', function() {
assert(Array.isArray(this.widgets));