Created
August 1, 2021 06:46
-
-
Save Goldziher/180256e706dcd8f721e3b1563d89d147 to your computer and use it in GitHub Desktop.
Example of using FixtureFactory in a snapshot test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { UserDTOFactory } from '@shared/factories/User.dto.factory'; | |
import { render } from '@testing-library/react'; | |
import UserProfile from '@frontend/pages/user-profile'; | |
describe('UserProfile', () => { | |
it('matches snapshot', () => { | |
const user = UserDTOFactory.fixtureSync( | |
__dirname + '/UserProfile.spec.json', | |
) | |
const { container } = render(<UserProfile user={user} /> ); | |
expect(container).toMatchSnapshot() | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment