Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Error while testing with jest #7

Open
negative0 opened this issue Jul 10, 2019 · 0 comments
Open

Error while testing with jest #7

negative0 opened this issue Jul 10, 2019 · 0 comments

Comments

@negative0
Copy link

Version

This is the line from my package.json:
"@toast-ui/react-image-editor": "^1.0.0"

Test Environment

Firefox, Pop_OS 18.04
Node: v10.16.0.

Current Behaviour:

The code is working fine in the brower, but when I try to do snapshot test of the component with ImageLoader in it, I get the following error:

FAIL src/views/Explorer/RemoteExplorerLayout/RemoteExplorerLayout.test.js
● Test suite failed to run

TypeError: Cannot read property 'createClass' of undefined

   7 | import 'tui-image-editor/dist/tui-image-editor.css'
   8 | 
>  9 | import ImageEditor from '@toast-ui/react-image-editor'
     | ^
  10 | 
  11 | function ImageLoader({downloadURL, inViewport, imageData, downloadImage, currentPath}) {
  12 | 

  at Object.<anonymous> (node_modules/tui-image-editor/dist/tui-image-editor.js:12869:39)

Component:

const myTheme = {
            // Theme object to extends default dark theme.
        };
        const MyComponent = () => (
            <ImageEditor
                includeUI={{
                    loadImage: {
                        path: imageData.data,
                        name: 'SampleImage'
                    },
                    theme: myTheme,
                    menu: ['shape', 'filter', 'crop'],
                    initMenu: 'filter',
                    uiSize: {
                        width: '80vw',
                        height: '90vh'
                    },
                    menuBarPosition: 'bottom',
                }}
                cssMaxHeight={500}
                cssMaxWidth={700}
                selectionStyle={{
                    cornerSize: 20,
                    rotatingPointOffset: 70
                }}
                usageStatistics={false}
            />
        );
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant