-
Notifications
You must be signed in to change notification settings - Fork 0
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
added unit tests #2
Conversation
expect(receivedEvents[0].timestamp).toEqual(123); | ||
expect(axios.post).toHaveBeenCalledTimes(2); | ||
}); | ||
|
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 would be useful to add a test that checks the behavior of the class when the call to Elasticsearch
fails (eg using jest.MockRejectedValue to simulate a network error). This would cover cases of failure handling.
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.
Excelent! code coverage went to 98% :D
onEventsReceived: async (highestTimestamp, events) => {receivedEvents = events;}, | ||
setLastProcessedTimestamp: async (timestamp: number) => {}, | ||
}); | ||
|
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.
add expect for mockResponse just to check that the response from ElasticSearch is []
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.
No, since I won't receive anything because the es response doesn't contain any hit
No description provided.