Skip to content

Commit

Permalink
(#156) Incorrect return type in Jest fileTransformer.js SVG processing
Browse files Browse the repository at this point in the history
* added the code key to the fileTransform return for SVG

Closes #156
  • Loading branch information
belaolsonNIH authored and adriancofie committed Nov 21, 2024
1 parent 49be2f3 commit 1e9f6f7
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions config/jest/fileTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@ module.exports = {
pascalCase: true,
});
const componentName = `Svg${pascalCaseFilename}`;
return `const React = require('react');
module.exports = {
__esModule: true,
default: ${assetFilename},
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
return {
$$typeof: Symbol.for('react.element'),
type: 'svg',
ref: ref,
key: null,
props: Object.assign({}, props, {
children: ${assetFilename}
})
};
}),
};`;
return { code: `const React = require('react');
module.exports = {
__esModule: true,
default: ${assetFilename},
ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
return {
$$typeof: Symbol.for('react.element'),
type: 'svg',
ref: ref,
key: null,
props: Object.assign({}, props, {
children: ${assetFilename}
})
};
}),
};`
};
}
return { code: `module.exports = ${assetFilename};` };
},
Expand Down

0 comments on commit 1e9f6f7

Please sign in to comment.