diff --git a/src/camera.test.tsx b/src/camera.test.tsx new file mode 100644 index 0000000..72076c8 --- /dev/null +++ b/src/camera.test.tsx @@ -0,0 +1,20 @@ +import { mount } from 'enzyme'; +import React from 'react'; +import Camera from './camera'; + +describe('Camera', () => { + it('Turning a Todo item into Done', () => { + let imgBase64 = undefined; + const handlePhotograph = (base64) => { + imgBase64 = base64; + console.log(base64) + }; + + const camera = mount(); + const button = camera.find('button').at(0); + + button.simulate('click'); + + expect(typeof imgBase64 === 'string').toEqual(true); + }) +}); diff --git a/src/camera.tsx b/src/camera.tsx index 702ce4e..73f0a45 100644 --- a/src/camera.tsx +++ b/src/camera.tsx @@ -8,7 +8,7 @@ export interface ICameraProps { prefixCls?: string; style?: React.CSSProperties; videoWidth?: number; - onPhotograph: (image: string) => void; + onPhotograph?: (image: string) => void; } const Camera: React.FC = (props) => {