You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Swiper v10.2.0
Any jest-test return a lot of errors like: import styles, import Swiper, etc.
it requires hours of search and work to re-configure jest.config.js to make mock-test work...
Please consider to post some documentation on how to configure Swiper to pass jest-tests
Like this one (it pass fine if it's single):
importSwiperfrom'swiper';import{SwiperOptions}from'swiper/types';interfaceSwiperMethods{init: jest.Mock;destroy: jest.Mock;slideNext: jest.Mock;slidePrev: jest.Mock;}jest.mock('swiper',()=>{constSwiperMock=jest.fn().mockImplementation(()=>({init: jest.fn(),destroy: jest.fn(),slideNext: jest.fn(),slidePrev: jest.fn(),}));return{__esModule: true,default: SwiperMock,};});jest.mock('swiper/modules',()=>({Navigation: (props: SwiperOptions['navigation']): boolean=>props==null,}));jest.mock('swiper/modules',()=>({Pagination: (props: SwiperOptions['pagination']): boolean=>props==null,}));describe('Swiper Mock Test',(): void=>{letswiper: SwiperMethods;beforeEach((): void=>{swiper=newSwiper('.swiper-container')asunknownasSwiperMethods;});test('Swiper should have init method',(): void=>{expect(swiper.init).toBeDefined();});test('init method should be called during Swiper initialization',(): void=>{swiper.init();expect(swiper.init).toHaveBeenCalled();});test('Swiper should have destroy method',(): void=>{expect(swiper.destroy).toBeDefined();});test('destroy method should be called when Swiper is destroyed',(): void=>{swiper.destroy();expect(swiper.destroy).toHaveBeenCalled();});});
The text was updated successfully, but these errors were encountered:
Swiper v10.2.0
Any jest-test return a lot of errors like: import styles, import Swiper, etc.
it requires hours of search and work to re-configure jest.config.js to make mock-test work...
Please consider to post some documentation on how to configure Swiper to pass jest-tests
Like this one (it pass fine if it's single):
The text was updated successfully, but these errors were encountered: