Created
June 24, 2022 22:25
-
-
Save ruanlinos/bcfe1c6bcf13d5e96bb82be180f41d90 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 {shallow} from "enzyme"; | |
import React, {ReactElement, ReactNode} from "react"; | |
import {Input} from "../Input"; | |
import * as Formik from 'formik'; | |
describe('Input component testing', () => { | |
let wrapper: any; | |
const useFormikContextMock = jest.spyOn(Formik, 'useFormikContext'); | |
beforeEach(() => { | |
useFormikContextMock.mockReturnValue({ | |
errors: { | |
test: "error" | |
}, | |
touched: { | |
test: true | |
}, | |
}) | |
}) | |
it('should match with snapshot', () => { | |
const renderedComponent = shallow( | |
<Input name="test" label="Test"/> | |
) | |
expect(renderedComponent).toMatchSnapshot() | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment