-
Notifications
You must be signed in to change notification settings - Fork 29
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
jaltekruse
wants to merge
37
commits into
Doenet:legacy
Choose a base branch
from
jaltekruse:php-tests-and-error-boundaries-may-16-rebase
base: legacy
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Php tests and error boundaries in react router #2140
jaltekruse
wants to merge
37
commits into
Doenet:legacy
from
jaltekruse:php-tests-and-error-boundaries-may-16-rebase
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
jaltekruse
commented
May 17, 2023
- 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
… 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
…plete cypress test
- 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()
… failed network request
…hares a route with the parent
…be treated differently
…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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.