Skip to content

Commit

Permalink
improve comment and add explanation for icon name setting
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Sep 16, 2022
1 parent b6d9615 commit b3ab1ba
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ jest.mock('../src/components/Icon/Expensicons', () => {
const reduce = require('underscore').reduce;
const Expensicons = jest.requireActual('../src/components/Icon/Expensicons');
return reduce(Expensicons, (prev, _curr, key) => {
// We set the name of the anonymous mock function here so we can dynamically build the list of mocks and access the
// "name" property to use in accessibility hints for element querying
const fn = () => '';
Object.defineProperty(fn, 'name', {
value: key,
configurable: true,
});
Object.defineProperty(fn, 'name', {value: key});
return {...prev, [key]: fn};
}, {});
});

0 comments on commit b3ab1ba

Please sign in to comment.