Skip to content

Conversation

@dannyprikaz
Copy link
Member

Addresses #1487

What changes did you make and why did you make them ?

Fixed backend tests so that they all pass (most of the time)
  • In backend/models/project.test.js by putting setupDB method in beforeAll it was creating infinite regression. setupDB has a beforeAll block inside it.
  • In backend/models/user.test.js, same as backend/models/project.test.js
  • In backend/workers/createRecurringEvents.test.js mocked versions of all methods were being imported because of backend/jest.setup.js line 15 jest.mock('./workers/createRecurringEvents');. None of the expected calls were happening. Using jest.requireActual fixes the problem.
  • In backend/workers/createRecurringEvents.test.js there were several error logs that could be fixed by setting a default resolved value for fetch
Adjusted `package.json` so that `npm run test:all` will successfully complete client and backend tests.
  • In package.json test:all was referencing outdated scripts for client-mvp and was terminating before backend tests. Also, cypress tests are not working because of a lack of a custom header.

NOTE

Some tests are still failing intermittently due to some configuration issue, likely with the setting up of Mongoose. This needs more investigation, but it seemed worthwhile to fix these tests while I was working on it.

Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)

Visuals before changes are applied

1487 pre

Visuals after changes are applied

1487 post

@dannyprikaz
Copy link
Member Author

Want to review this pull request? Take a look at this documentation for a step by step guide!

From your project repository, check out a new branch and test the changes.

git checkout -b dannyprikaz-1487-backend-test-fixes
git pull https://github.com/dannyprikaz/VRMS.git 1487-backend-test-fixes

Copy link
Member

@trillium trillium left a comment

Choose a reason for hiding this comment

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

Thanks for your work here Danny!

"test:client": "cd client && npm run test",
"test:client-mvp": "cd client-mvp-04 && npm run test",
"test:all": "cross-env NODE_ENV=test npm run test:client && npm run test:client-mvp && npm run test:backend && npm run test:cy"
"test:all": "cross-env NODE_ENV=test npm run test:client && npm run test:backend"
Copy link
Member

Choose a reason for hiding this comment

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

Writing for clarity here that we're removing test:client-mvp and test:cy

@trillium
Copy link
Member

I don't really have notes to provide because I don't understand this test suite all that much at the moment, but its been broken for a minute and we're moving towards getting it resolved!~

@trillium trillium merged commit 86e5a47 into hackforla:development Mar 19, 2025
2 of 5 checks passed
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