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 0a8e4a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/image-alt-text/opportunityHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function syncAltTextSuggestions({ opportunity, newSuggestions, log

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

// Remove existing suggestions that were not ignored
await Promise.all(existingSuggestions
Expand Down
4 changes: 3 additions & 1 deletion test/audits/image-alt-text/opportunity-handler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,18 @@ describe('Image Alt Text Opportunity Handler', () => {
it('should preserve ignored suggestions when syncing', async () => {
dataAccessStub.Opportunity.allBySiteIdAndStatus.resolves([altTextOppty]);

// Mock existing suggestions with one ignored
// Mock existing suggestions with one ignored - update to include data.id
const mockSuggestions = [
{
id: 'suggestion-1',
status: SuggestionModel.STATUSES.SKIPPED,
data: { recommendations: [{ id: 'suggestion-1' }] }, // Add data.id to match handler's expectation
remove: sinon.stub().resolves(),
},
{
id: 'suggestion-2',
status: 'NEW',
data: { recommendations: [{ id: 'suggestion-2' }] }, // Add data.id to match handler's expectation
remove: sinon.stub().resolves(),
},
];
Expand Down

0 comments on commit 0a8e4a0

Please sign in to comment.