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

URL: Use test data from web-platform-tests for isURL spec conformance #20534

Closed
aduth opened this issue Feb 28, 2020 · 0 comments · Fixed by #20537
Closed

URL: Use test data from web-platform-tests for isURL spec conformance #20534

aduth opened this issue Feb 28, 2020 · 0 comments · Fixed by #20537
Assignees
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

Comments

@aduth
Copy link
Member

aduth commented Feb 28, 2020

The @wordpress/url implementation of isURL 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 own isURL tests.

Implementation Notes:

  • Note that the URL standard is a living standard, and as such may change over time. Additionally, the web-platform-tests project may seek to add or change the test cases. Based on this, we should anticipate that the test data may need to update to use a more recent copy.
  • We could choose to load the file over the network by referencing the repository URL, but we should be mindful to avoid inadvertent test failures caused by network instability.
  • We should not want the tests to suddenly fail, thus the test data should be pinned to a specific version that we can update as needed.
  • In mind of all of the above, we probably want a local copy of urltestdata.json, optionally reduced to the minimal set of properties, since we only need input and failure properties for our purposes. For easy updates, we could consider writing an ad hoc script within the url package whose implementation would download and transform the latest version.
@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Package] Url /packages/url labels Feb 28, 2020
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant