Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: _glide.default is not a constructor #636

Open
arslanalidev opened this issue Dec 19, 2022 · 2 comments
Open

TypeError: _glide.default is not a constructor #636

arslanalidev opened this issue Dec 19, 2022 · 2 comments

Comments

@arslanalidev
Copy link

I had make a slider with GlideJS. This widget is working fine. But when I am writing the jest test. My Test is failing, it's saying TypeError: Cannot read property 'querySelector' of undefined. Here is the complete error while I am playing the test case.

        TypeError: Cannot read property 'querySelector' of undefined

      55 |     const slider = new Glide(sliderRef.current, options);
      56 |
    > 57 |     slider.mount();
         |            ^
      58 |   }, [options]);
      59 |
      60 |   const handleOnMouseEnter = () => setNavigationVisible(true);

Here is the Test Suite which I write down.

    import React from 'react';
    import renderer from 'react-test-renderer';
    import Widget from './Widget';
    
    const mockArray = [
      { title: 'Mock Title 1', completed: false },
      { title: 'Mock Title 2', completed: false },
      { title: 'Mock Title 3', completed: false },
    ];
    describe('Widget', () => {
      it('renders Widget according to design', () => {
        const component = renderer.create(
          <Widget lessons={mockArray} title={'mock title'} />
        );
        const tree = component.toJSON();
    
        expect(tree).toMatchSnapshot();
      });
    });

@VasekProchazka
Copy link

Do you find any solution for this issue ?

@ericmorand
Copy link
Contributor

@arslanalidev what is the error?

TypeError: _glide.default is not a constructor

or

TypeError: Cannot read property 'querySelector' of undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants