/* eslint-env jest */ import AmpHtmlValidator from 'next/dist/compiled/amphtml-validator' export async function validateAMP(/** @type {string} */ html) { const validatorPath = getBundledAmpValidatorFilepath() const validator = await getAmpValidatorInstance(validatorPath) const result = validator.validateString(html) const errors = result.errors.filter((error) => { if (error.severity === 'ERROR') { // Unclear yet if these actually prevent the page from being indexed by the AMP cache. // These are coming from React so all we can do is ignore them for now. // // https://github.com/ampproject/amphtml/issues/40279 if ( error.code === 'DISALLOWED_ATTR' && error.params[0] === 'blocking' && error.params[1] === 'link' ) { return false } //