URL: Use test data from web-platform-tests for isURL spec conformance #20534
Labels
[Package] Url
/packages/url
[Status] In Progress
Tracking issues with work in progress
[Type] Automated Testing
Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
[Type] Task
Issues or PRs that have been broken down into an individual action to take
The
@wordpress/url
implementation ofisURL
is documented as to conform to the URL Standard definition of a valid URL string. There are test cases to verify this behavior, but they are written ad hoc based on our own understanding of what should and should not be considered a valid URL.However, there is a canonical resource for test data associated with web standards:
https://github.com/web-platform-tests/wpt
Specifically, there is test data provided which can be used to assert whether a given input should be considered valid:
https://github.com/web-platform-tests/wpt/blob/master/url/resources/urltestdata.json
Per #20435 (comment), our current alignment of "valid" only checks whether a parse would fail. In the above data set, this is reflected as the
"failure": true
object value.Task: Use
urltestdata.json
from the above repository as reference data to use in our ownisURL
tests.Implementation Notes:
urltestdata.json
, optionally reduced to the minimal set of properties, since we only needinput
andfailure
properties for our purposes. For easy updates, we could consider writing an ad hoc script within theurl
package whose implementation would download and transform the latest version.The text was updated successfully, but these errors were encountered: