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

Php tests and error boundaries in react router #2140

Draft
wants to merge 37 commits into
base: legacy
Choose a base branch
from

Conversation

jaltekruse
Copy link
Contributor

  • this is based on top of the branch that adds Jest, so comments on those first couple of commits can be directed to the dedicated PR for that - Add jest for javascript testing #2138
  • I want to add tests for the error boundaries, but we won't necessarily always be able to manipulate the back-end to throw an error for any request using the tools accessible from cypress. We still want to test we have defensive code in javascript if unexpected things happen, like the database being temporarily down, future code changes cause bugs, etc.
  • So I wanted to have both the error boundaries code together with adding javascript unit tests, as I think we will likely need to have some off the test coverage for handling errors to be just in javascript and simulating error responses from the server, I'll be adding those tests soon
  • I still need to do a little cleanup on this branch before it is ready for merging, but I wanted to get up the example of a php based test for an API

jaltekruse and others added 30 commits May 15, 2023 11:21
… together

- current error - TypeError: Cannot read properties of undefined (reading 'subscribe')
- I forgot to stage the right file last commit, so I didn't save my in-progress state, but I did end up copying it to start with the simpler version and fix it
- was a minor fix to get the code to run from a unit test, will
  worry about this later when I finish that test and fix the bug
…cally, must use axios requests! don't use fetch()
…reading results from SQL is safe, TODO still need to cast to tinyint to make it clear what is a boolean
…ecking for SQL errors, remove some boilerplate
- had to implement a little workaround for capturing script output, as PHPUnit has some
  functionality around this, but it is a bit restrictive. You cannot include/call more than one
  script while also wanting to assert on the output of any of the scripts, as it doesn't include
  an API to clear the output buffer, just to access the current contents, which can still be
  appended to by later code run during the test. This also include test setup code.
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