diff --git a/src/backlinks/handler.js b/src/backlinks/handler.js index 4bfad765..d50de1e8 100644 --- a/src/backlinks/handler.js +++ b/src/backlinks/handler.js @@ -18,6 +18,8 @@ import AhrefsAPIClient from '@adobe/spacecat-shared-ahrefs-client'; import { AbortController, AbortError } from '@adobe/fetch'; import { retrieveSiteBySiteId, syncSuggestions } from '../utils/data-access.js'; import { enhanceBacklinksWithFixes } from '../support/utils.js'; +import { AuditBuilder } from '../common/audit-builder.js'; +import { noopUrlResolver } from '../common/audit.js'; const TIMEOUT = 3000; @@ -60,7 +62,7 @@ export async function filterOutValidBacklinks(backlinks, log) { return backlinks.filter((_, index) => backlinkStatuses[index]); } -export default async function auditBrokenBacklinks(message, context) { +export async function auditBrokenBacklinks(message, context) { const { type, auditContext = {} } = message; const { dataAccess, log, sqs } = context; const { @@ -219,3 +221,8 @@ export default async function auditBrokenBacklinks(message, context) { return internalServerError(`Internal server error: ${e.message}`); } } + +export default new AuditBuilder() + .withUrlResolver(noopUrlResolver) + .withRunner(auditBrokenBacklinks) + .build(); diff --git a/src/metatags/handler.js b/src/metatags/handler.js index 698890db..da0b6b36 100644 --- a/src/metatags/handler.js +++ b/src/metatags/handler.js @@ -18,6 +18,8 @@ import { retrieveSiteBySiteId } from '../utils/data-access.js'; import { getObjectFromKey, getObjectKeysUsingPrefix } from '../utils/s3-utils.js'; import SeoChecks from './seo-checks.js'; import syncOpportunityAndSuggestions from './opportunityHandler.js'; +import { AuditBuilder } from '../common/audit-builder.js'; +import { noopUrlResolver } from '../common/audit.js'; async function fetchAndProcessPageObject(s3Client, bucketName, key, prefix, log) { const object = await getObjectFromKey(s3Client, bucketName, key, log); @@ -35,7 +37,7 @@ async function fetchAndProcessPageObject(s3Client, bucketName, key, prefix, log) }; } -export default async function auditMetaTags(message, context) { +export async function auditMetaTags(message, context) { const { type, auditContext = {} } = message; const siteId = message.siteId || message.url; const { @@ -120,3 +122,8 @@ export default async function auditMetaTags(message, context) { return internalServerError(`Internal server error: ${e.message}`); } } + +export default new AuditBuilder() + .withUrlResolver(noopUrlResolver) + .withRunner(auditMetaTags) + .build(); diff --git a/test/audits/backlinks.test.js b/test/audits/backlinks.test.js index 1539ae2d..bc5f40f5 100644 --- a/test/audits/backlinks.test.js +++ b/test/audits/backlinks.test.js @@ -22,7 +22,7 @@ import chaiAsPromised from 'chai-as-promised'; import sinon from 'sinon'; import sinonChai from 'sinon-chai'; import nock from 'nock'; -import auditBrokenBacklinks from '../../src/backlinks/handler.js'; +import { auditBrokenBacklinks } from '../../src/backlinks/handler.js'; use(sinonChai); use(chaiAsPromised); diff --git a/test/audits/metatags.test.js b/test/audits/metatags.test.js index f44b8339..07d68c53 100644 --- a/test/audits/metatags.test.js +++ b/test/audits/metatags.test.js @@ -27,7 +27,7 @@ import { SEO_RECOMMENDATION, MULTIPLE_H1_ON_PAGE, SHOULD_BE_PRESENT, TAG_LENGTHS, ONE_H1_ON_A_PAGE, } from '../../src/metatags/constants.js'; import SeoChecks from '../../src/metatags/seo-checks.js'; -import auditMetaTags from '../../src/metatags/handler.js'; +import { auditMetaTags } from '../../src/metatags/handler.js'; import syncOpportunityAndSuggestions from '../../src/metatags/opportunityHandler.js'; import testData from '../fixtures/meta-tags-data.js';