Skip to content

Commit

Permalink
fix: adding detected item types
Browse files Browse the repository at this point in the history
  • Loading branch information
dzehnder committed Aug 22, 2024
1 parent 711b292 commit 67edb70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/structured-data/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ export async function processStructuredData(baseURL, context, pages) {
lastCrawlTime: inspectionResult?.indexStatusResult?.lastCrawlTime,
};

const detectedItemTypes = [];
const filteredRichResults = inspectionResult?.richResultsResult?.detectedItems?.map(
(item) => {
detectedItemTypes.push(item?.richResultType);
const filteredItems = item?.items?.filter(
(issueItem) => issueItem?.issues?.some(
(issue) => issue?.severity === 'ERROR',
Expand Down Expand Up @@ -80,6 +82,7 @@ export async function processStructuredData(baseURL, context, pages) {
richResults: inspectionResult?.richResultsResult
? {
verdict: inspectionResult.richResultsResult.verdict,
detectedItemTypes,
detectedIssues: filteredRichResults,
}
: {},
Expand Down
8 changes: 8 additions & 0 deletions test/audits/structured-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ describe('URLInspect Audit', () => {
},
richResults: {
verdict: 'PASS',
detectedItemTypes: [
'Product snippets',
'Merchant listings',
],
detectedIssues: [
{
richResultType: 'Product snippets',
Expand Down Expand Up @@ -180,6 +184,10 @@ describe('URLInspect Audit', () => {
},
richResults: {
verdict: 'PASS',
detectedItemTypes: [
'Product snippets',
'Merchant listings',
],
detectedIssues: [
{
richResultType: 'Product snippets',
Expand Down

0 comments on commit 67edb70

Please sign in to comment.