WordPress / theme-review-action

Other
30 stars 9 forks source link

Test if theme and author URI have a valid responses #52

Closed carolinan closed 3 years ago

carolinan commented 3 years ago

Fixes https://github.com/WordPress/theme-review-action/issues/42

Use pageStatusTest to test theme and author URI fetched from _siteInfo.themeurls.

Tested by changing the theme and author URI of the test theme.

Resulting error report when the URL does not return 202:

Expected to received a 200 status for https://wordpress.org/gfdgfd. Received 404.
See: https://github.com/WordPress/theme-review-action/blob/trunk/docs/ui-errors.md#page-should-return-200-status
carolinan commented 3 years ago

As I submitted this, I realized I never tested what happens if the style.css file header is empty:

Theme URI:
Author URI:

So I put this PR as draft while I continue.

Update: In this scenario, the test does not complete and the following error shows:

Error: .each called with an empty Array of table data.

73 | let theme_urls = [...siteInfo.theme_urls];
74 | 
> 75 | describe.each( theme_urls )('Test URL %s%s', ( url ) => {
carolinan commented 3 years ago

if ( theme_urls !== null ) { Feels a bit primitive but it means that if the links have not been added, the test does not run, if there is one link, the test still runs and passes and fails correctly.