diff --git a/examples/custom-preset-tests-only.js b/examples/custom-preset-tests-only.js index c1fc070..b5e00fa 100644 --- a/examples/custom-preset-tests-only.js +++ b/examples/custom-preset-tests-only.js @@ -25,8 +25,9 @@ structuredDataTest(url, { }) .catch(err => { if (err.type === 'VALIDATION_FAILED') { - console.log('❌ Some tests failed.') result = err.res + console.log('❌ Some tests failed.') + console.log("⚠️ Errors:\n", result.failed.map(test => test)) } else { console.log(err) // Handle other errors here (e.g. an error fetching a URL) } @@ -39,9 +40,5 @@ structuredDataTest(url, { `Warnings: ${result.warnings.length}`, ) console.log(`Schemas found: ${result.schemas.join(',')}`) - - // Loop over validation errors - if (result.failed.length > 0) - console.log("⚠️ Errors:\n", result.failed.map(test => test)) } }) \ No newline at end of file diff --git a/examples/test-multiple-urls.js b/examples/test-multiple-urls.js index 92e6635..0e6575b 100644 --- a/examples/test-multiple-urls.js +++ b/examples/test-multiple-urls.js @@ -11,19 +11,19 @@ const urls = [ urls.forEach(url => { let result - structuredDataTest(url, { + structuredDataTest(url, { presets: [ Google, Twitter, Facebook ], }) .then(res => { - console.log(`✅ ${url}`) result = res + console.log(`✅ ${url}`) }) .catch(err => { if (err.type === 'VALIDATION_FAILED') { - console.log(`❌ ${url}`) result = err.res + console.log(`❌ ${url}`) } else { - console.log(err) // Handle other errors here (e.g. an error fetching a URL) + console.error(err) // Handle other errors here (e.g. an error fetching a URL) } }) .finally(() => { @@ -34,9 +34,6 @@ urls.forEach(url => { ` Warnings: ${result.warnings.length}`, ) console.log(` Schemas found: ${result.schemas.join(',')}`) - - // Loop over validation errors - //if (result.failed.length > 0) console.log("⚠️ Errors:\n", result.failed.map(test => test)) } }) }) \ No newline at end of file diff --git a/examples/test-url.js b/examples/test-url.js index ee14b6a..7d0ebe2 100644 --- a/examples/test-url.js +++ b/examples/test-url.js @@ -13,15 +13,16 @@ structuredDataTest(url, { schemas: [ 'ReportageNewsArticle' ] }) .then(res => { - console.log('✅ All tests passed!') result = res + console.log('✅ All tests passed!') }) .catch(err => { if (err.type === 'VALIDATION_FAILED') { - console.log('❌ Some tests failed.') result = err.res + console.log('❌ Some tests failed.') + console.log("⚠️ Errors:\n", result.failed.map(test => test)) } else { - console.log(err) // Handle other errors here (e.g. an error fetching a URL) + console.error(err) // Handle other errors here (e.g. an error fetching a URL) } }) .finally(() => { @@ -32,9 +33,5 @@ structuredDataTest(url, { `Warnings: ${result.warnings.length}`, ) console.log(`Schemas found: ${result.schemas.join(',')}`) - - // Loop over validation errors - if (result.failed.length > 0) - console.log("⚠️ Errors:\n", result.failed.map(test => test)) } }) \ No newline at end of file