refactor tests

This commit is contained in:
Maciej Winnicki 2016-12-14 10:47:45 +01:00
parent 145911a6ae
commit 9f3b218157
No known key found for this signature in database
GPG Key ID: 950BD3CA7EDF6008
2 changed files with 6 additions and 7 deletions

View File

@ -84,7 +84,6 @@ class AwsInvoke {
log(invocationReply) {
const color = !invocationReply.FunctionError ? 'white' : 'red';
if (invocationReply.Payload) {
const response = JSON.parse(invocationReply.Payload);
@ -120,7 +119,7 @@ class AwsInvoke {
}
if (invocationReply.FunctionError) {
return BbPromise.reject(new Error('Invoked function errored'));
return BbPromise.reject(new Error('Invoked function failed'));
}
return BbPromise.resolve();

View File

@ -260,7 +260,7 @@ describe('AwsInvoke', () => {
return awsInvoke.log(invocationReplyMock);
});
it('rejects the promise for failed invocations', (done) => {
it('rejects the promise for failed invocations', () => {
const invocationReplyMock = {
Payload: `
{
@ -271,10 +271,10 @@ describe('AwsInvoke', () => {
FunctionError: true,
};
awsInvoke.log(invocationReplyMock).then(() => {
done(new Error('Promise resolved'));
}, () => {
done();
return awsInvoke.log(invocationReplyMock).catch(err => {
expect(err).to
.and.be.instanceof(Error)
.and.have.property('message', 'Invoked function failed');
});
});
});