mirror of
https://github.com/serverless/serverless.git
synced 2026-02-01 16:07:28 +00:00
refactor tests
This commit is contained in:
parent
145911a6ae
commit
9f3b218157
@ -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();
|
||||
|
||||
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user