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

test: added route level integration testing #645

Merged
merged 2 commits into from
Sep 29, 2020
Merged

Conversation

Oxiang
Copy link
Contributor

@Oxiang Oxiang commented Sep 28, 2020

Problem

Rewrote: Route level integration testing
Migrated to this branch for new timeline

Solution

Mocking the express app and calling the route with supertest
Mocked first layer session to bypass userguard when required
Set up mocks for each required route test

New scripts:

  • All Route test scripts are under test/server/api

New dev dependencies:

  • supertest
  • @types/supertest

- use supertest for testing routes
- set up a mock app for route testing
- add a mock middleware in mock app as bypass for routes that uses session
@Oxiang
Copy link
Contributor Author

Oxiang commented Sep 28, 2020

Rewrote commit message

Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

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

per comments

test/server/api/setup.ts Outdated Show resolved Hide resolved
test/server/api/setup.ts Outdated Show resolved Hide resolved
test/server/api/LinkStatsRoute.test.ts Outdated Show resolved Hide resolved
test/server/api/LinkStatsRoute.test.ts Outdated Show resolved Hide resolved
- change reporting style for route tests
- fix warnings by lint from unknown functions
- added commentary for set up on sequalize
@Oxiang Oxiang requested a review from LoneRifle September 28, 2020 08:21
Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

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

I'm going to approve this for now, but I had hoped for a more thorough revision of the PR such that, amongst other things:

  • test() would have been replaced by it()
  • proper tense was used for the test titles

Feel free to proceed with merging when ready.

@Oxiang Oxiang merged commit 0cb066e into develop Sep 29, 2020
@Oxiang Oxiang deleted the new-testing-branch branch September 29, 2020 03:44
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.

2 participants