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

CHE-195 Create BE Test Setup #154

Merged
merged 21 commits into from
Jun 22, 2024
Merged

Conversation

seantokuzo
Copy link
Contributor

Description

  • adds setup file for BE tests to connect to test mongo container and clear out the DB before each test
  • adds global.login helper function that generates valid cookie - for testing protected routes
  • adds shell script & npm script & compose file for running tests on individual files
  • adjusts jest configs to handle BE and FE respectively
  • skips current tests affected by changes
  • add .DS_Store to .gitignore because it showed up in my working directory - get outta here with that ish Mac

Jira Task

JIRA BILLET

Testing Instructions

  • run npm run docker-test:solo Authenticated
  • enter C for client when prompted
  • Make sure only AuthenticatedApp.test.tsx runs and passes
  • create a file in the server/controllers/ directory named derp.test.ts and copy the following code into it:
    it('gets a valid cookie with global login helper', async () => { const cookie = await login(); console.log(cookie); expect(cookie[0].split('=')[0]).toEqual('token'); });
  • run npm run docker-test:solo derp
  • enter S for server when prompted
  • Make sure only derp.test.ts runs and passes and logs the cookie value

Checklist

All Team Members

  • I added a descriptive title to this PR.
  • I filled out the Description, Jira Task, and Testing Instructions sections above.
  • I added or updated [Jest unit tests]for any changes to components, server-side controllers, etc.
  • I ran npm run docker-test in my local environment to check that this PR passes all unit tests.
  • I did a quick check to make sure my code changes follow the recomended style guide.

@seantokuzo seantokuzo requested a review from brok3turtl3 June 22, 2024 01:18
Copy link
Contributor

@brok3turtl3 brok3turtl3 left a comment

Choose a reason for hiding this comment

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

@seantokuzo Set up looks good! 🎉

Left a comment regarding a couple possible file deletions. As well, we should consider setting up Postgres as well but we can do that in a subsequent ticket. There is enough mongo based testing to keep us busy for awhile.

Copy link
Contributor

Choose a reason for hiding this comment

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

@seantokuzo This file and userController can probably just be deleted at this point. The new ticket suite will encompass any testing that existed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as profile controller. Lets axe it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good rename.

Copy link
Contributor

Choose a reason for hiding this comment

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

derp derp 🤣

@brok3turtl3 brok3turtl3 added the enhancement New feature or request label Jun 22, 2024
@brok3turtl3 brok3turtl3 merged commit f0621c0 into dev Jun 22, 2024
1 check passed
@brok3turtl3 brok3turtl3 deleted the CHE-195/subtask/Create-BE-Test-Setup branch June 22, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants