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

Fix Feedback Page jest tests #670

Closed
6 tasks done
nclairesays opened this issue Dec 3, 2020 · 13 comments
Closed
6 tasks done

Fix Feedback Page jest tests #670

nclairesays opened this issue Dec 3, 2020 · 13 comments

Comments

@nclairesays
Copy link
Member

nclairesays commented Dec 3, 2020

Fix breaking Public Comment jest tests so that tests can run in CI pipeline

  • Rename all code and db objects from Public Comment to Feedback, including the client-side routing path to /feedback
  • rename and move postPublicComment.js to /src/services/feedback-service.js
  • rename PublicCommentPage.js to FeeddbackPage.js
  • remove postPublicComment.test.js - I don't think the test has value.
  • rename PublicCommentPage.test.js to FeedbackPage.test.js
  • debug FeedbackPage.test.js to get tests working.
@KPHowley KPHowley modified the milestone: 11/24/2020 Dec 5, 2020
@KPHowley KPHowley added the role: back-end Node/Express Development Task label Dec 5, 2020
@nclairesays

This comment was marked as outdated.

@nclairesays nclairesays added role: front-end Front End Developer dev: tests and removed role: back-end Node/Express Development Task labels Dec 17, 2020
@nclairesays nclairesays changed the title Fix jest tests Fix breaking Public Comment jest tests Dec 17, 2020
@nclairesays
Copy link
Member Author

Spent some time trying to fix the frontend tests but am unable to get it to pass properly even though I am using patterns I know "should" work. I think that the errors are due to library version compatibility but have not validated this.

Next person who picks up this issue, look into versions for the following libraries: jest, react, react-dom, react-testing-library, and maybe nock if we want to use nock. There are ways to test api calls without using nock.

@fyliu
Copy link
Member

fyliu commented Sep 22, 2021

I wasn't able to spend much time on this. I will do more this week.

I'm able to run the simplest nock+axios test https://www.npmjs.com/package/nock#axios
I'm thinking of using the nock recorder feature to figure out if our expected request is correct.

@fyliu
Copy link
Member

fyliu commented Sep 23, 2021

@nclairesays I only fixed the existing tests in the file.
It can be possibly expanded to record the real responses to the requests and then testing against them.

I also read that msw mocks works for both the server and client at the same time, so that might be worth looking into just to save developer time. https://github.com/mswjs/msw

@fyliu
Copy link
Member

fyliu commented Sep 24, 2021

@nclairesays I might just leave this alone for now. I tried a while ago to test something with that toast provider context and wasn't able get it working.

@fyliu fyliu removed their assignment Sep 24, 2021
@mojimoh
Copy link
Member

mojimoh commented Jan 28, 2023

Have a discussion with John and Bonnie about the value of continuing this work so that we can prioritize this issue.

@mojimoh

This comment was marked as off-topic.

@jahpe777
Copy link
Member

jahpe777 commented Apr 15, 2023

I fixed the tests having to do with updating to React 18 ('RuleInput.test.js') but the tests for 'tdm-engine.test.js' need to be updated. I'm switching to issue #780 for now.

@jahpe777
Copy link
Member

Created a PR for @entrotech so that he can carry out the tests regarding the TDM engine and keep the updates I made regarding the tests having to do with updating to React 18.

@jahpe777 jahpe777 assigned entrotech and unassigned jahpe777 Apr 20, 2023
@Biuwa
Copy link
Member

Biuwa commented Jun 15, 2023

Please provide an update:

Progress: "What is the current status of your project? What have you completed and what is left to do?"
Blockers: "Difficulties or errors encountered."
Availability: "How much time will you have this week to work on this issue?"
ETA: "When do you expect this issue to be completed?"
Pictures (if necessary): "Add any pictures that will help illustrate what you are working on.

@ExperimentsInHonesty
Copy link
Member

@entrotech
Copy link
Member

@ZekeAranyLucas @agosmou Since you guys seem to be getting into jest testing, I thought I'd have go at trying to fix this long-standing issue. Everything that used to be called Public Comment is changed to Feedback - since the Public Comment period was last year, and we are re-purposing the page for general feedback on the site.

I got the first test in FeedbackPage.test.js working, and spent a bit of time trying to get the second test working, but didn't get very far. It seems to be a problem with mocking all the dependencies of for the test properly and/or possibly implementing some sort of wait for the async post to be completed to verfiy that the post is called.

It's not clear to me if the feedback.service.test.js test have any value, so I didn't try very hard to get them working. I'd be interested in your opinions.

I thought this might be an issue that one of you could figure out. I'm merging the issue to the develop branch, since it is a step forward, and doesn't break anything that was previously working.

@entrotech entrotech changed the title Fix breaking Public Comment jest tests Fix Feedback Page jest tests Nov 20, 2023
@ZekeAranyLucas ZekeAranyLucas self-assigned this Nov 30, 2023
@ExperimentsInHonesty ExperimentsInHonesty moved this to Technical Review in P: TDM: project board Jun 11, 2024
@ExperimentsInHonesty ExperimentsInHonesty added the pbv: dev All engineering issues label Jun 11, 2024
@entrotech
Copy link
Member

Per @ZekeAranyLucas , the Feedback page tests were unreliable, and preventing us from developing a suite of reliable unit tests.

@entrotech entrotech closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@github-project-automation github-project-automation bot moved this from Technical Review to On Dev - not yet pushed to Prod in P: TDM: project board Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Released
Development

No branches or pull requests