Skip to content
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

Fix jazz logs unit test #830

Closed
wants to merge 4 commits into from
Closed

Fix jazz logs unit test #830

wants to merge 4 commits into from

Conversation

davidsims9t
Copy link

Requirements

  • Run npm test in core/jazz_logs

Description of the Change

I fixed the four broken unit tests in this branch as well as upgraded sinon to the latest version. I changed the request() call to request.post() so that I could stub this request in the unit test. request() apparently is impossible to stub which you can read about here: https://stackoverflow.com/questions/20050507/creating-request-stub-with-sinon-in-mocha

I replaced sinon.stub(object, "method", func) with sinon.stub(object, "method").callsFake(func) as the first method is deprecated.

I added LOG_LEVELS to the test config JSON file. This is required, otherwise map() blows up and makes the tests fail.

Benefits

The unit tests pass

Possible Drawbacks

I'm not sure if there's any potential issues by using request.post() instead of request(), but there shouldn't be.

Applicable Issues

#625

@suryajak suryajak changed the base branch from master to develop February 13, 2019 15:46
@@ -6,6 +6,7 @@ const awsContext = require('aws-lambda-mock-context');
const sinon = require('sinon');
const logger = require("../components/logger.js");
const request = require('request');
const _ = require('lodash');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are reducing our dependence on third-party libraries. One of them is lodash. We are replacing all lodash usages in the code with js native functions. Please remove lodash and use native functions

@rkothapalli rkothapalli changed the base branch from develop to ui-enhancements April 22, 2019 23:26
@devsatishm
Copy link
Contributor

Closing due to inactivity.

@devsatishm devsatishm closed this Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants