1
0
Fork 0

Fix error expecations

This commit is contained in:
Alan Plum 2017-05-17 12:33:41 +02:00
parent 819a1194ba
commit 599ed214c6
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
1 changed files with 15 additions and 51 deletions

View File

@ -110,13 +110,8 @@ describe('Foxx Manager install', function () {
expect(function () {
FoxxManager.install(fs.join(basePath, 'malformed-controller-path'), '/unittest/broken');
}).to.throw(ArangoError).that.satisfies(function (err) {
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_FAILURE.code);
if (require('@arangodb').isServer) {
expect(err).to.have.property('cause').that.is.an.instanceof(ArangoError)
.with.a.property('errorNum', errors.ERROR_SYS_ERROR.code);
} else {
expect(err).not.to.have.property('cause');
}
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_NOT_FOUND.code);
expect(err).not.to.have.property('cause');
return true;
});
});
@ -125,11 +120,10 @@ describe('Foxx Manager install', function () {
expect(function () {
FoxxManager.install(fs.join(basePath, 'broken-controller-file'), '/unittest/broken');
}).to.throw(ArangoError).that.satisfies(function (err) {
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_FAILURE.code);
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_SYNTAX_ERROR.code);
if (require('@arangodb').isServer) {
expect(err).to.have.property('cause');
expect(err.cause).not.to.be.an.instanceof(SyntaxError);
expect(err.cause).not.to.be.an.instanceof(ArangoError);
expect(err).to.have.property('cause')
.that.is.an.instanceof(SyntaxError);
} else {
expect(err).not.to.have.property('cause');
}
@ -188,14 +182,8 @@ describe('Foxx Manager install', function () {
expect(function () {
FoxxManager.install(fs.join(basePath, 'malformed-exports-path'), '/unittest/broken');
}).to.throw(ArangoError).that.satisfies(function (err) {
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_FAILURE.code);
if (require('@arangodb').isServer) {
expect(err).to.have.property('cause')
.that.is.an.instanceof(ArangoError)
.with.a.property('errorNum', errors.ERROR_SYS_ERROR.code);
} else {
expect(err).not.to.have.property('cause');
}
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_NOT_FOUND.code);
expect(err).not.to.have.property('cause');
return true;
});
});
@ -219,14 +207,8 @@ describe('Foxx Manager install', function () {
expect(function () {
FoxxManager.install(fs.join(basePath, 'malformed-setup-path'), '/unittest/broken');
}).to.throw(ArangoError).that.satisfies(function (err) {
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_FAILURE.code);
if (require('@arangodb').isServer) {
expect(err).to.have.property('cause')
.that.is.an.instanceof(ArangoError)
.with.a.property('errorNum', errors.ERROR_SYS_ERROR.code);
} else {
expect(err).not.to.have.property('cause');
}
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_NOT_FOUND.code);
expect(err).not.to.have.property('cause');
return true;
});
});
@ -235,14 +217,8 @@ describe('Foxx Manager install', function () {
expect(function () {
FoxxManager.install(fs.join(basePath, 'missing-controller-file'), '/unittest/broken');
}).to.throw(ArangoError).that.satisfies(function (err) {
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_FAILURE.code);
if (require('@arangodb').isServer) {
expect(err).to.have.property('cause')
.that.is.an.instanceof(ArangoError)
.with.a.property('errorNum', errors.ERROR_SYS_ERROR.code);
} else {
expect(err).not.to.have.property('cause');
}
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_NOT_FOUND.code);
expect(err).not.to.have.property('cause');
return true;
});
});
@ -251,14 +227,8 @@ describe('Foxx Manager install', function () {
expect(function () {
FoxxManager.install(fs.join(basePath, 'missing-exports-file'), '/unittest/broken');
}).to.throw(ArangoError).that.satisfies(function (err) {
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_FAILURE.code);
if (require('@arangodb').isServer) {
expect(err).to.have.property('cause')
.that.is.an.instanceof(ArangoError)
.with.a.property('errorNum', errors.ERROR_SYS_ERROR.code);
} else {
expect(err).not.to.have.property('cause');
}
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_NOT_FOUND.code);
expect(err).not.to.have.property('cause');
return true;
});
});
@ -267,14 +237,8 @@ describe('Foxx Manager install', function () {
expect(function () {
FoxxManager.install(fs.join(basePath, 'missing-setup-file'), '/unittest/broken');
}).to.throw(ArangoError).that.satisfies(function (err) {
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_FAILURE.code);
if (require('@arangodb').isServer) {
expect(err).to.have.property('cause')
.that.is.an.instanceof(ArangoError)
.with.a.property('errorNum', errors.ERROR_SYS_ERROR.code);
} else {
expect(err).not.to.have.property('cause');
}
expect(err).to.have.property('errorNum', errors.ERROR_MODULE_NOT_FOUND.code);
expect(err).not.to.have.property('cause');
return true;
});
});