Opened 9 years ago
Closed 9 years ago
#40734 closed defect (bug) (fixed)
REST API: Tests: Prohibit errors when generating wp-api.js fixtures
| Reported by: | jnylen0 | Owned by: | jnylen0 |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.8 |
| Component: | Build/Test Tools | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | rest-api |
Description
In #39264 we added tests for wp-api.js to core, including a wp-api-generated.js fixture file that is automatically generated from API requests during test suite runs.
While reviewing #40450 I found that some of these requests are erroring, so we are storing error responses in the fixture data. For example:
- https://core.trac.wordpress.org/browser/tags/4.7.4/tests/qunit/fixtures/wp-api-generated.js#L3394
- https://core.trac.wordpress.org/browser/tags/4.7.4/tests/qunit/fixtures/wp-api-generated.js#L3567
I fixed this by requiring a 200 status code for these requests (they are all GET requests) and updating everything to send the right kind of data. I also needed to update the $fixture_replacements array which replaces dynamic data with static values - instructions for doing so are at comment:29:ticket:39264.
Note, the patch attached to this ticket needs to be applied after #40450.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 40629: