Testing

This section helps you to integrate SVGR with your test framework.

Use with Jest

Create a mock file:

import * as React from 'react'
export default 'SvgrURL'
const SvgrMock = React.forwardRef((props, ref) => <span ref={ref} {...props} />)
export const ReactComponent = SvgrMock

Then specify it in your Jest configuration:

{
"moduleNameMapper": {
"\\.svg": "<rootDir>/__mocks__/svgrMock.js"
}
}