import React, { PropsWithChildren } from 'react' import renderer from 'react-test-renderer' // react-slick "Cannot read property 'querySelectorAll' of null" // 具体原因不明,详情可尝试去掉这段 mock 即可 // eslint-disable-next-line react/display-name jest.mock('react-slick', () => ({ children }: PropsWithChildren<{}>) =>
{children}
) // eslint-disable-next-line import/first import Carousel from '.' describe('Carousel', () => { test('basic.', () => { const tree = renderer.create( <>
default carousel
is suitable for light content
with no arrows
primary carousel
is suitable for dark content
with no arrows
secondary carousel
is suitable for multiple scenes
with arrows
).toJSON() expect(tree).toMatchSnapshot() }) test('small size', () => { const tree = renderer.create( <>
default carousel
is suitable for light content
with no arrows
primary carousel
is suitable for dark content
with no arrows
secondary carousel
is suitable for multiple scenes
with arrows
).toJSON() expect(tree).toMatchSnapshot() }) })