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

Unit tests restructuring #370

Merged
merged 12 commits into from
Jan 6, 2021
Merged

Unit tests restructuring #370

merged 12 commits into from
Jan 6, 2021

Conversation

nikithauc
Copy link
Contributor

This PR focusses to improve the existing test structure of the project. Changes are as follows -

  1. Added testing tools -
    a. Karma - To test the unit test in browsers
    b. @istanbuljs/nyc-config-typescript - Evaluation of the test coverage
  2. Restructured the test folders as follows
    a. Renamed from folder spec/ to test/
    b. Divided unit test in folders - common, node and browser.
    c. Removed the config files from the test folder.
  3. The JS SDK is transpiled into CommonJs and ESM modules. Added esm dependency to test run mocha tests on transpiled ESM modules.
  4. Some tests were failing when I was using the latest version of isomorphic-fetch/ cross-fetch/via karma. Updated those tests to align to the updates in the fetch api. Updated the isomorphic-fetch dependency.
  5. Corrected some invalid tests.
  6. Added headers as a property in the ChaosHandlerOptions. I plan for some more the ChaosHandlerOptions design changes but not in this PR.

TODO - Check if the any changes are needed in the GraphResponseHandler to adhere to fetch api/http/ Graph Response standards. Will create a follow up PR if any changes are present

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

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

Great work, this modernizes the test infrastructure. I noticed some TODO's were remaining, but my guess is that it's why this PR is still in draft.

@nikithauc
Copy link
Contributor Author

Great work, this modernizes the test infrastructure. I noticed some TODO's were remaining, but my guess is that it's why this PR is still in draft.

Thanks! This PR is not marked as draft. It is #371 that is marked as draft.

@baywet
Copy link
Member

baywet commented Jan 4, 2021

Copy link
Contributor

@MIchaelMainer MIchaelMainer left a comment

Choose a reason for hiding this comment

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

with comments

CONTRIBUTING.md Outdated

Once you have done with your changes, You have to build and test your changes
To build the library run,
Once you have done with your changes, You have to build and test your changes To build the library run,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit for grammar, punctuation, and voice (passive)

Once you have done with your changes, You have to build and test your changes To build the library run,

becomes

Build and test your changes with the following commands after you have completed your work:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


Karma is used for testing the code in browsers. To run the unit tests using karma run the following steps -

- Run the script npm install
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Run the script npm install
Run the script npm run test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

test/node/content/BatchResponseContent.ts Outdated Show resolved Hide resolved
@nikithauc nikithauc changed the base branch from dev to 3.0.0 January 5, 2021 23:58
@nikithauc nikithauc merged commit eceb67e into 3.0.0 Jan 6, 2021
@nikithauc nikithauc deleted the code-coverage branch January 6, 2021 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants