Skip to content

Commit

Permalink
Clean up, fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Jan 9, 2025
1 parent 51576aa commit b884006
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/support/steps/lcp-beacon-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ Then('lcp and atf images are not written to LL format', async function (this: IC
const expected = jsonData[key];

const lcpResult = await checkLcpOrViewport(lcpLLImages, key, 'LCP', expected.lcp);
if (!lcpResult.isValid) {
if (lcpResult && !lcpResult.isValid) {
truthy = false;
failMsg += lcpResult.errorMessages.join('');
}

const viewportResult = await checkLcpOrViewport(lcpLLImages, key, 'Viewport', expected.viewport);
if (!viewportResult.isValid) {
if (viewportResult && !viewportResult.isValid) {
truthy = false;
failMsg += viewportResult.errorMessages.join('');
}
Expand Down
8 changes: 4 additions & 4 deletions utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ const getDir = async (file: string): Promise<string> => {
/**
* Check LCP/ATF images does not have lazyload attribute, either as image or background-image
*/
export const checkLcpOrViewport: (images: LLImagesData, type: string, key: string, values: string[]) => Promise<{
export const checkLcpOrViewport = async (images: LLImagesData, type: string, key: string, values: string[]): Promise<{
isValid: boolean;
errorMessages: string[]
}> = async (images: LLImagesData, type: string, key: string, values: string[]) => {
}> => {
let result = {
lcpImage: '',
lcpLLStatus: true,
Expand Down Expand Up @@ -108,9 +108,9 @@ export const checkLcpOrViewport: (images: LLImagesData, type: string, key: strin
`Expected ${type} for - ${value} for ${lcpUrl} is lazyloaded - ${result.lcpImage}\n\n\n`
);
}

return { isValid, errorMessages };
}

return { isValid, errorMessages };
}
/**
* Read the content of a file.
Expand Down

0 comments on commit b884006

Please sign in to comment.