fix(extensions): Add missing return values

This commit is contained in:
Juan Tejada 2016-01-04 13:23:24 -05:00
parent 9530a84877
commit d12e4fdc81
2 changed files with 8 additions and 4 deletions

View file

@ -129,10 +129,12 @@ describe('ComposerExtensionAdapter', ()=> {
const extension = {
finalizeSessionBeforeSending(sess) {
methodSpy(sess);
return 'result';
},
};
adapter.adaptComposerMethod(extension, 'finalizeSessionBeforeSending');
extension.finalizeSessionBeforeSending({session});
const res = extension.finalizeSessionBeforeSending({session});
expect(res).toEqual('result');
expect(methodSpy).toHaveBeenCalledWith(session);
});
@ -142,10 +144,12 @@ describe('ComposerExtensionAdapter', ()=> {
const extension = {
warningsForSending(dr) {
methodSpy(dr);
return 'result';
},
};
adapter.adaptComposerMethod(extension, 'warningsForSending');
extension.warningsForSending({draft});
const res = extension.warningsForSending({draft});
expect(res).toEqual('result');
expect(methodSpy).toHaveBeenCalledWith(draft);
});
});

View file

@ -29,11 +29,11 @@ export function adaptComposerMethod(extension, method) {
if (method === 'finalizeSessionBeforeSending') {
extension[method] = (argsObj)=> {
original(argsObj.session);
return original(argsObj.session);
};
} else {
extension[method] = (argsObj)=> {
original(argsObj.draft);
return original(argsObj.draft);
};
}
}