Fix tests

This commit is contained in:
Gaël Métais
2014-11-28 17:22:32 +01:00
parent 1f83fe1b48
commit 2a316ebb1e
10 changed files with 117 additions and 94 deletions
+31 -24
View File
@@ -13,16 +13,19 @@ describe('phantomasWrapper', function() {
this.timeout(15000);
phantomasWrapper.execute({
url: url,
options: {}
}).then(function(json) {
json.should.be.an('object');
json.should.have.a.property('generator');
json.generator.should.contain('phantomas');
json.should.have.a.property('url').that.equals(url);
json.should.have.a.property('metrics').that.is.an('object').not.empty;
json.should.have.a.property('offenders').that.is.an('object').not.empty;
json.offenders.should.have.a.property('javascriptExecutionTree').that.is.a('array').not.empty;
params: {
url: url,
options: {}
}
}).then(function(data) {
data.should.be.an('object');
data.should.have.a.property('generator');
data.generator.should.contain('phantomas');
data.should.have.a.property('url').that.equals(url);
data.should.have.a.property('metrics').that.is.an('object').not.empty;
data.should.have.a.property('offenders').that.is.an('object').not.empty;
data.offenders.should.have.a.property('javascriptExecutionTree').that.is.a('array').not.empty;
done();
}).fail(function(err) {
@@ -36,9 +39,11 @@ describe('phantomasWrapper', function() {
this.timeout(15000);
phantomasWrapper.execute({
url: url,
options: {}
}).then(function(json) {
params: {
url: url,
options: {}
}
}).then(function(data) {
done('Error: unwanted success');
@@ -56,19 +61,21 @@ describe('phantomasWrapper', function() {
this.timeout(5000);
phantomasWrapper.execute({
url: url,
options: {
timeout: 1
params: {
url: url,
options: {
timeout: 1
}
}
}).then(function(json) {
}).then(function(data) {
json.should.be.an('object');
json.should.have.a.property('generator');
json.generator.should.contain('phantomas');
json.should.have.a.property('url').that.equals(url);
json.should.have.a.property('metrics').that.is.an('object').not.empty;
json.should.have.a.property('offenders').that.is.an('object').not.empty;
json.offenders.should.have.a.property('javascriptExecutionTree').that.is.a('array').not.empty;
data.should.be.an('object');
data.should.have.a.property('generator');
data.generator.should.contain('phantomas');
data.should.have.a.property('url').that.equals(url);
data.should.have.a.property('metrics').that.is.an('object').not.empty;
data.should.have.a.property('offenders').that.is.an('object').not.empty;
data.offenders.should.have.a.property('javascriptExecutionTree').that.is.a('array').not.empty;
done();
}).fail(function(err) {