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

Fixes issues in testing #160

Merged
merged 4 commits into from
Jul 29, 2020
Merged

Conversation

ksraj123
Copy link
Contributor

@ksraj123 ksraj123 commented Jul 28, 2020

Problem

Github Issue Number: #152 , #161

Solution of problem

Issue 152

  • Updated routes in test file
  • db operation was being carried out after db was already cleared by beforeEach, this caused an mongoose error, added await to async task
  • updated tests to expect the right status code, redirection gives 302

Issue 161

  • fixed 400 issue in user route, GET /user/invite expected role in query string but the test did not provide any, due to this the decrypted token in the controller of GET /user/invite/:token did not had a role property which caused it to return 400
  • fixes error address in use error for all test files, added a guard to app.js to start server only when the environment is not testing, which was causing this issue
  • fixed issues with propsal route, Proposal schema did not have a organization property this caused the json returned from the controller of POST /proposal to not have organization property as well which was the reason for the test failing. Added the organization property to Proposal schema but did not made it required to ensure something else does not break due to this.
  • fixed jest not exiting, some tests started the server in beforeAll but did not close it in afterAll which was causing this issue.

Type of Change

  • Bug fix
  • New Feature
  • Development of UI/UX prototypes
  • Small refactor
  • Change in Documentation

Checklist

  • My code follows the same style as the codebase
  • My Code change requires a change in documentation
  • I have updated the Readme accordingly
  • I made PR against development branch
  • I have run the test cases locally and it's passing.
  • I have squashed my commits

@ksraj123
Copy link
Contributor Author

@Rupeshiya @AuraOfDivinity @devesh-verma Please review

@Rupeshiya
Copy link
Member

Hi @ksraj123, Could you please run the test case locally and add the screenshot here?

@ksraj123
Copy link
Contributor Author

@Rupeshiya Sure, Here it is.
Screenshot from 2020-07-29 02-28-50

@Rupeshiya
Copy link
Member

Cool, Looks fine!!

@AuraOfDivinity
Copy link
Collaborator

Looks good for me!

@ksraj123 ksraj123 changed the title [Fix #152] - Fix failing test cases in the user route [WIP] Fixes issues in testing Jul 29, 2020
@ksraj123
Copy link
Contributor Author

ksraj123 commented Jul 29, 2020

  • EADDRINUSE Issue fixed for all routes
    Screenshot from 2020-07-29 12-35-23

  • Issues in proposal route fixed
    Screenshot from 2020-07-29 12-51-22

  • Fixed issues with org route
    Screenshot from 2020-07-29 14-36-15

  • All test cases passing
    Screenshot from 2020-07-29 14-33-40

@codecov
Copy link

codecov bot commented Jul 29, 2020

Codecov Report

Merging #160 into development will decrease coverage by 5.33%.
The diff coverage is 55.45%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #160      +/-   ##
===============================================
- Coverage        68.85%   63.51%   -5.34%     
===============================================
  Files               26       46      +20     
  Lines              687     1472     +785     
  Branches            94      180      +86     
===============================================
+ Hits               473      935     +462     
- Misses             191      477     +286     
- Partials            23       60      +37     
Impacted Files Coverage Δ
app/controllers/auth.js 83.33% <ø> (-2.39%) ⬇️
app/middleware/auth.js 93.33% <ø> (ø)
app/models/Event.js 61.90% <ø> (ø)
app/models/Organisation.js 55.55% <ø> (ø)
app/models/Post.js 66.66% <ø> (ø)
app/models/Project.js 60.00% <ø> (ø)
app/models/UrlShortner.js 100.00% <ø> (ø)
app/routes/index.js 83.33% <ø> (+8.33%) ⬆️
app/routes/urlShortner.js 100.00% <ø> (ø)
app/utils/response-helper.js 37.50% <0.00%> (ø)
... and 56 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48e8523...ab05538. Read the comment docs.

@ksraj123 ksraj123 changed the title [WIP] Fixes issues in testing Fixes issues in testing Jul 29, 2020
@vaibhavdaren vaibhavdaren merged commit 8f92e6b into codeuino:development Jul 29, 2020
vaibhavdaren added a commit that referenced this pull request Aug 7, 2020
* added update restrictions, techStacks in project and orgId to a user

* added edit restriction mechanism

* intial deactivation mechanism

* intial logging mechanism and deactive account

* issue fix

* fixing org creation issue

* Fixes issues in testing (#160)

* fix failing test file user.test.js

* fixes EADDRINUSE while testing

* fixes issues in prposal route

* fixed issues in org route and added new tests

* Moving Google Analytics requests to backend (#154)

* Moving Google Analytics requetss to backend

* Requested Changes

* Minor changes

* Adding code to prevent attacks (#153)

* modified user's api (#168)

* modified user's api

* login options during login

* Changes for reactions (#166)

Co-authored-by: Rupeshiya <[email protected]>
Co-authored-by: Devesh Verma <[email protected]>
Co-authored-by: Kumar Saurabh Raj <[email protected]>
Co-authored-by: Asel Peiris <[email protected]>
Co-authored-by: pranjals149 <[email protected]>
vaibhavdaren added a commit that referenced this pull request Sep 13, 2020
* added update restrictions, techStacks in project and orgId to a user

* added edit restriction mechanism

* intial deactivation mechanism

* intial logging mechanism and deactive account

* issue fix

* fixing org creation issue

* Fixes issues in testing (#160)

* fix failing test file user.test.js

* fixes EADDRINUSE while testing

* fixes issues in prposal route

* fixed issues in org route and added new tests

* Moving Google Analytics requests to backend (#154)

* Moving Google Analytics requetss to backend

* Requested Changes

* Minor changes

* Adding code to prevent attacks (#153)

* modified user's api (#168)

* modified user's api

* login options during login

* Changes for reactions (#166)

Co-authored-by: Rupeshiya <[email protected]>
Co-authored-by: Devesh Verma <[email protected]>
Co-authored-by: Kumar Saurabh Raj <[email protected]>
Co-authored-by: Asel Peiris <[email protected]>
Co-authored-by: pranjals149 <[email protected]>

Co-authored-by: Devesh Verma <[email protected]>
Co-authored-by: Vaibhav D. Aren <[email protected]>
Co-authored-by: Kumar Saurabh Raj <[email protected]>
Co-authored-by: Asel Peiris <[email protected]>
Co-authored-by: pranjals149 <[email protected]>
vaibhavdaren added a commit that referenced this pull request Sep 13, 2020
* added update restrictions, techStacks in project and orgId to a user

* added edit restriction mechanism

* intial deactivation mechanism

* intial logging mechanism and deactive account

* issue fix

* fixing org creation issue

* Fixes issues in testing (#160)

* fix failing test file user.test.js

* fixes EADDRINUSE while testing

* fixes issues in prposal route

* fixed issues in org route and added new tests

* Moving Google Analytics requests to backend (#154)

* Moving Google Analytics requetss to backend

* Requested Changes

* Minor changes

* Adding code to prevent attacks (#153)

* modified user's api (#168)

* modified user's api

* login options during login

* Changes for reactions (#166)

* Revert "Adding code to prevent attacks (#153)" (#170)

This reverts commit 57a0cf9.

* Fixed and written all the missing test cases (#172)

* update code

* fixed failing test cases and missing test cases

* User activity tracker using redis (#174)

* update code

* initial mechanism for user tracking

initial mechanism for user tracking

* Security issue (#177)

* update code

* fix security flaws

* fixed test cases

* minor fixes (#178)

* add docs for new contributors (#181)

Co-authored-by: Devesh Verma <[email protected]>
Co-authored-by: Kumar Saurabh Raj <[email protected]>
Co-authored-by: Asel Peiris <[email protected]>
Co-authored-by: pranjals149 <[email protected]>
Co-authored-by: Vaibhav D. Aren <[email protected]>
vaibhavdaren added a commit that referenced this pull request Sep 13, 2020
* added update restrictions, techStacks in project and orgId to a user

* added edit restriction mechanism

* intial deactivation mechanism

* intial logging mechanism and deactive account

* issue fix

* fixing org creation issue

* Fixes issues in testing (#160)

* fix failing test file user.test.js

* fixes EADDRINUSE while testing

* fixes issues in prposal route

* fixed issues in org route and added new tests

* Moving Google Analytics requests to backend (#154)

* Moving Google Analytics requetss to backend

* Requested Changes

* Minor changes

* Adding code to prevent attacks (#153)

* modified user's api (#168)

* modified user's api

* login options during login

* Changes for reactions (#166)

* Revert "Adding code to prevent attacks (#153)" (#170)

This reverts commit 57a0cf9.

* Fixed and written all the missing test cases (#172)

* update code

* fixed failing test cases and missing test cases

* User activity tracker using redis (#174)

* update code

* initial mechanism for user tracking

initial mechanism for user tracking

* Security issue (#177)

* update code

* fix security flaws

* fixed test cases

* minor fixes (#178)

* add docs for new contributors (#181)

* frontend sync master gsoc  (#169) (#191)

* added update restrictions, techStacks in project and orgId to a user

* added edit restriction mechanism

* intial deactivation mechanism

* intial logging mechanism and deactive account

* issue fix

* fixing org creation issue

* Fixes issues in testing (#160)

* fix failing test file user.test.js

* fixes EADDRINUSE while testing

* fixes issues in prposal route

* fixed issues in org route and added new tests

* Moving Google Analytics requests to backend (#154)

* Moving Google Analytics requetss to backend

* Requested Changes

* Minor changes

* Adding code to prevent attacks (#153)

* modified user's api (#168)

* modified user's api

* login options during login

* Changes for reactions (#166)

Co-authored-by: Rupeshiya <[email protected]>
Co-authored-by: Devesh Verma <[email protected]>
Co-authored-by: Kumar Saurabh Raj <[email protected]>
Co-authored-by: Asel Peiris <[email protected]>
Co-authored-by: pranjals149 <[email protected]>

Co-authored-by: Devesh Verma <[email protected]>
Co-authored-by: Vaibhav D. Aren <[email protected]>
Co-authored-by: Kumar Saurabh Raj <[email protected]>
Co-authored-by: Asel Peiris <[email protected]>
Co-authored-by: pranjals149 <[email protected]>

Co-authored-by: Rupeshiya <[email protected]>
Co-authored-by: Devesh Verma <[email protected]>
Co-authored-by: Kumar Saurabh Raj <[email protected]>
Co-authored-by: Asel Peiris <[email protected]>
Co-authored-by: pranjals149 <[email protected]>
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