You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ structuredDataTest }=require('structured-data-testing-tool')consturl='https://www.bbc.co.uk/news/world-us-canada-49060410'consttestUrl='https://www.bbc.co.uk/news/world-us-canada-49060410_EXTRA_TEXT'constCustomPreset={name: 'Non-premium About Page',description: 'Test all the structured data is correct for Non-premium about tab',tests: [// Check 'NewsArticle' schema exists in JSON-LD{test: 'ReportageNewsArticle',expect: true,type: 'jsonld'},// Check a 'NewsArticle' schema exists with 'url' property set to the value of the variable 'url'{test: 'ReportageNewsArticle[*].url',expect: testUrl},// A similar check as above, but won't fail (only warn) if the test doesn't pass{test: 'ReportageNewsArticle[*].mainEntityOfPage',expect: testUrl,warning: true},// Test for a Twitter meta tag with specific value{test: '"twitter:domain"',expect: 'www.bbc.co.uk',type: 'metatag'}]};letresultstructuredDataTest(url,{// Check for compliance with Google, Twitter and Facebook recommendationspresets: [CustomPreset],// Check the page includes a specific Schema (see https://schema.org/docs/full.html for a list)}).then(res=>{console.log('✅ All tests passed!')result=res}).catch(err=>{if(err.type==='VALIDATION_FAILED'){console.log('❌ Some tests failed.')result=err.res}else{console.log(err)// Handle other errors here (e.g. an error fetching a URL)}}).finally(()=>{if(result){console.log(`Passed: ${result.passed.length},`,`Failed: ${result.failed.length},`,`Warnings: ${result.warnings.length}`,)console.log(`Schemas found: ${result.schemas.join(',')}`)// Loop over validation errorsif(result.failed.length>0)console.log("⚠️ Errors:\n",result.failed.map(test=>test))}})
I receive
❌ Some tests failed.
Passed: 3, Failed: 1, Warnings: 1
Schemas found: ReportageNewsArticle
⚠️ Errors:
[ { test: 'ReportageNewsArticle[*].url',
expect:
'https://www.bbc.co.uk/news/world-us-canada-49060410_EXTRA_TEXT',
group: 'Non-premium About Page',
passed: false,
type: 'any',
value: null,
error:
{ type: 'NOT_FOUND',
message: 'The property "ReportageNewsArticle[*].url" was not found' } } ]
Include either CLI command or example code which can be used to reproduce the behavior.
Expected behavior
Should it be ?
type: 'INCORRECT_VALUE',
message: Incorrect value found for "${path}",
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
Incorrect error is displayed
To Reproduce
After run of
I receive
Include either CLI command or example code which can be used to reproduce the behavior.
Expected behavior
Should it be ?
type: 'INCORRECT_VALUE',
message:
Incorrect value found for "${path}"
,Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: