Created
June 29, 2022 22:13
-
-
Save ruanlinos/f2c9db13ca090a7cac85eb60e984c31b 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