New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session y struct #1
Conversation
Pull Request Test Coverage Report for Build 1057049128
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Te deje algunos comentarios (más que nada typos y ajustes en el JSDoc).
Lo que sí falta, es documentar en el README. Hay que documentar tanto el struct, como el messageAttributes
con janis-client
que se debe mandar y que si se manda, vas a tener el this.session
disponible en tu handler..
lib/sqs-handler.js
Outdated
* @param {import('./sqs-consumer')} Consumer | ||
* @param {SQSEvent} event | ||
* @param {boolean} isBatch | ||
* @returns {Promise} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solo para dejar en claro que el valor al que resuelve va a ser ignorado...
* @returns {Promise} | |
* @returns {Promise<void>} |
tests/sqs-handler.js
Outdated
sinon.assert.calledOnceWithExactly(ConditionalConsumer.prototype.setSession, { clientCode: 'fizzmodarg' }); | ||
}); | ||
|
||
it('Should pass the event by the consumer with the sessions are setted', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('Should pass the event by the consumer with the sessions are setted', async () => { | |
it('Should pass the event to the consumer with the session set for each of them', async () => { |
tests/sqs-handler.js
Outdated
sinon.assert.calledWithExactly(ConditionalConsumer.prototype.setSession.getCall(1), { clientCode: 'test' }); | ||
}); | ||
|
||
it('Should pass the event by the consumer with the sessions are setted and omit the session for the record without client', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('Should pass the event by the consumer with the sessions are setted and omit the session for the record without client', async () => { | |
it('Should pass the event to the consumer with the sessions set only for the records with janis-client and omitted for the records without it', async () => { |
tests/sqs-handler.js
Outdated
await assert.doesNotReject(SQSHandler.handle(ConditionalConsumerWithArrayStruct, eventWithoutClient)); | ||
}); | ||
|
||
it('Should throw error if the structure body in the records are not correct for a batch', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('Should throw error if the structure body in the records are not correct for a batch', async () => { | |
it('Should reject if the body structure of the records are invalid when processing a batch', async () => { |
tests/sqs-handler.js
Outdated
sinon.assert.calledWithExactly(ConditionalConsumer.prototype.setSession.getCall(1), { clientCode: 'test' }); | ||
}); | ||
|
||
it('Should process if the structure body in the records are correct', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('Should process if the structure body in the records are correct', async () => { | |
it('Should process if the body structure in the records are valid', async () => { |
tests/sqs-handler.js
Outdated
sinon.assert.notCalled(ConditionalConsumerWithStruct.prototype.processBatch); | ||
}); | ||
|
||
it('Should throw error if the structure body in the records are not correct at processing one by one', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('Should throw error if the structure body in the records are not correct at processing one by one', async () => { | |
it('Should reject if the body structure of the records are invalid when processing one by one', async () => { |
Se agregaron dos puntos: