Skip to content

Commit

Permalink
fix: access right subproperty
Browse files Browse the repository at this point in the history
  • Loading branch information
JayKid committed Feb 24, 2025
1 parent dbc7f6c commit 5543f44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/image-alt-text/opportunityHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export async function syncAltTextSuggestions({ opportunity, newSuggestions, log
const existingSuggestions = await opportunity.getSuggestions();

// eslint-disable-next-line max-len
const ignoredSuggestions = existingSuggestions.filter((s) => s.status === SuggestionModel.STATUSES.SKIPPED);
const ignoredSuggestionIds = ignoredSuggestions.map((s) => s.id);
const ignoredSuggestions = existingSuggestions.filter((s) => s.getStatus() === SuggestionModel.STATUSES.SKIPPED);
const ignoredSuggestionIds = ignoredSuggestions.map((s) => s.getData().recommendations[0].id);

// Remove existing suggestions that were not ignored
await Promise.all(existingSuggestions
Expand Down
5 changes: 5 additions & 0 deletions test/audits/image-alt-text/opportunity-handler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('Image Alt Text Opportunity Handler', () => {
save: sinon.stub(),
getSuggestions: sinon.stub().returns([{
id: 'suggestion-1',
getStatus: () => 'NEW',
status: 'NEW',
remove: sinon.stub().resolves(),
}]),
Expand Down Expand Up @@ -216,12 +217,16 @@ describe('Image Alt Text Opportunity Handler', () => {
const mockSuggestions = [
{
id: 'suggestion-1',
getStatus: () => SuggestionModel.STATUSES.SKIPPED,
status: SuggestionModel.STATUSES.SKIPPED,
getData: () => ({ recommendations: [{ id: 'suggestion-1' }] }),
remove: sinon.stub().resolves(),
},
{
id: 'suggestion-2',
getStatus: () => 'NEW',
status: 'NEW',
getData: () => ({ recommendations: [{ id: 'suggestion-2' }] }),
remove: sinon.stub().resolves(),
},
];
Expand Down

0 comments on commit 5543f44

Please sign in to comment.