Skip to content

Commit

Permalink
fix: update data access
Browse files Browse the repository at this point in the history
  • Loading branch information
dzehnder committed Aug 22, 2024
1 parent 67edb70 commit a6efed2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
13 changes: 8 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@adobe/helix-universal": "5.0.5",
"@adobe/helix-universal-logger": "3.0.18",
"@adobe/spacecat-shared-ahrefs-client": "1.5.0",
"@adobe/spacecat-shared-data-access": "1.42.0",
"@adobe/spacecat-shared-data-access": "1.43.2",
"@adobe/spacecat-shared-google-client": "1.2.0",
"@adobe/spacecat-shared-http-utils": "1.6.7",
"@adobe/spacecat-shared-rum-api-client": "2.7.3",
Expand Down
6 changes: 3 additions & 3 deletions src/structured-data/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ export async function structuredDataHandler(baseURL, context, site) {

const siteId = site.getId();

const productDetailPages = await site.getConfig().getProductDetailPages('structured-data');
if (isArray(productDetailPages) && productDetailPages.length === 0) {
const structuredDataURLs = await site.getConfig().getIncludedURLs('structured-data');
if (isArray(structuredDataURLs) && structuredDataURLs.length === 0) {
log.error(`No product detail pages found for site ID: ${siteId}`);
throw new Error(`No product detail pages found for site: ${baseURL}`);
}

const auditResult = await processStructuredData(baseURL, context, productDetailPages);
const auditResult = await processStructuredData(baseURL, context, structuredDataURLs);

const endTime = process.hrtime(startTime);
const elapsedSeconds = endTime[0] + endTime[1] / 1e9;
Expand Down
4 changes: 2 additions & 2 deletions test/audits/structured-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('URLInspect Audit', () => {
siteStub = {
getId: () => '123',
getConfig: () => ({
getProductDetailPages: () => ['https://example.com/product/1', 'https://example.com/product/2'],
getIncludedURLs: () => ['https://example.com/product/1', 'https://example.com/product/2'],
}),
};

Expand Down Expand Up @@ -251,7 +251,7 @@ describe('URLInspect Audit', () => {
it('throws error if there are no configured PDPs', async () => {
sandbox.stub(GoogleClient, 'createFrom').returns(googleClientStub);
siteStub.getConfig = () => ({
getProductDetailPages: () => [],
getIncludedURLs: () => [],
});
try {
await structuredDataHandler('https://www.example.com', context, siteStub);
Expand Down

0 comments on commit a6efed2

Please sign in to comment.