From 6f476ecdef9da088024c7c5ba7130e60304ea78b Mon Sep 17 00:00:00 2001
From: tony chen <329604487@qq.com>
Date: Mon, 14 Mar 2022 14:57:26 +0800
Subject: [PATCH] fix(rn): rn test use testing library (#11419)
* feat: refactory taro rn tests
* feat: update tsconfig
---
package.json | 7 +-
.../taro-components-rn/__mocks__/fileMock.js | 8 -
.../__snapshots__/checkbox.spec.tsx.snap | 90 -
.../__snapshots__/movableView.spec.tsx.snap | 33 -
.../__snapshots__/video.spec.tsx.snap | 114 -
.../__snapshots__/view.spec.tsx.snap | 3 -
.../__snapshots__/virtualList.spec.tsx.snap | 15 -
.../__tests__/button.-spec.tsx | 97 -
.../__tests__/camera.spec.tsx | 11 -
.../__tests__/checkbox.spec.tsx | 80 -
.../__tests__/icon.spec.tsx | 35 -
.../__tests__/image.spec.tsx | 60 -
.../__tests__/input.spec.tsx | 35 -
.../__tests__/movableArea.spec.tsx | 40 -
.../__tests__/scrollView.spec.tsx | 12 -
.../__tests__/text.spec.tsx | 22 -
.../__tests__/view.spec.tsx | 15 -
packages/taro-components-rn/jest.config.js | 31 +-
packages/taro-components-rn/package.json | 7 +-
packages/taro-components-rn/setup.js | 18 -
.../{ => src}/__tests__/1x1.png | Bin
.../__snapshots__/camera.spec.tsx.snap | 0
.../__snapshots__/pickerView.spec.tsx.snap | 148 +-
.../__snapshots__/richText.spec.tsx.snap | 0
.../__snapshots__/scrollView.spec.tsx.snap | 8 +-
.../__snapshots__/video.spec.tsx.snap | 181 ++
.../__snapshots__/virtualList.spec.tsx.snap | 28 +
.../src/__tests__/button.spec.tsx | 76 +
.../src/__tests__/camera.spec.tsx | 10 +
.../src/__tests__/checkbox.spec.tsx | 77 +
.../src/__tests__/icon.spec.tsx | 37 +
.../src/__tests__/image.spec.tsx | 39 +
.../src/__tests__/input.spec.tsx | 40 +
.../src/__tests__/movableArea.spec.tsx | 32 +
.../{ => src}/__tests__/movableView.spec.tsx | 13 +-
.../{ => src}/__tests__/pickerView.spec.tsx | 13 +-
.../{ => src}/__tests__/richText.spec.tsx | 7 +-
.../src/__tests__/scrollView.spec.tsx | 10 +
.../src/__tests__/text.spec.tsx | 17 +
.../{ => src}/__tests__/utils.spec.tsx | 2 +-
.../{ => src}/__tests__/video.spec.tsx | 10 +-
.../src/__tests__/view.spec.tsx | 13 +
.../{ => src}/__tests__/virtualList.spec.tsx | 11 +-
.../src/components/Button/index.tsx | 7 +-
.../src/components/Icon/index.tsx | 3 +-
.../src/components/Image/index.tsx | 1 +
.../src/components/MovableArea/index.tsx | 2 +-
.../src/components/MovableView/index.tsx | 2 +-
.../components/Video/__test__/video.test.js | 26 -
packages/taro-components-rn/src/setup.ts | 1 +
.../src/types/definition.d.ts | 5 +
packages/taro-components-rn/tsconfig.json | 12 +-
packages/taro-rn/jest.config.js | 33 +-
packages/taro-rn/package.json | 8 +-
.../__tests__/__mock__/mockAsyncStorage.js | 1 -
.../__tests__/__mock__/mockExpoPermissions.js | 2 +-
.../__snapshots__/interactive.test.js.snap | 1690 ---------------
.../__snapshots__/scanCode.test.js.snap | 113 +
.../taro-rn/src/__tests__/interactive.test.js | 106 +-
.../taro-rn/src/__tests__/keyboard.test.js | 12 +-
.../taro-rn/src/__tests__/scanCode.test.js | 14 +
.../taro-rn/src/__tests__/scanCode.test_.js | 24 -
.../taro-rn/src/__tests__/storage.test.js | 2 +-
packages/taro-rn/src/__tests__/system.test.js | 16 +-
packages/taro-rn/src/lib/Mask.tsx | 1 +
packages/taro-rn/src/lib/Popup.tsx | 2 +-
.../taro-rn/src/lib/connectSocket/index.ts | 1 -
packages/taro-rn/src/lib/request/index.ts | 2 +-
packages/taro-rn/src/lib/scanCode/index.tsx | 2 +-
packages/taro-rn/{setup.js => src/setup.ts} | 40 +-
packages/taro-router-rn/jest.config.js | 35 +-
yarn.lock | 1825 ++---------------
72 files changed, 1074 insertions(+), 4419 deletions(-)
delete mode 100644 packages/taro-components-rn/__mocks__/fileMock.js
delete mode 100644 packages/taro-components-rn/__tests__/__snapshots__/checkbox.spec.tsx.snap
delete mode 100644 packages/taro-components-rn/__tests__/__snapshots__/movableView.spec.tsx.snap
delete mode 100644 packages/taro-components-rn/__tests__/__snapshots__/video.spec.tsx.snap
delete mode 100644 packages/taro-components-rn/__tests__/__snapshots__/view.spec.tsx.snap
delete mode 100644 packages/taro-components-rn/__tests__/__snapshots__/virtualList.spec.tsx.snap
delete mode 100644 packages/taro-components-rn/__tests__/button.-spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/camera.spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/checkbox.spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/icon.spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/image.spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/input.spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/movableArea.spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/scrollView.spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/text.spec.tsx
delete mode 100644 packages/taro-components-rn/__tests__/view.spec.tsx
delete mode 100644 packages/taro-components-rn/setup.js
rename packages/taro-components-rn/{ => src}/__tests__/1x1.png (100%)
rename packages/taro-components-rn/{ => src}/__tests__/__snapshots__/camera.spec.tsx.snap (100%)
rename packages/taro-components-rn/{ => src}/__tests__/__snapshots__/pickerView.spec.tsx.snap (74%)
rename packages/taro-components-rn/{ => src}/__tests__/__snapshots__/richText.spec.tsx.snap (100%)
rename packages/taro-components-rn/{ => src}/__tests__/__snapshots__/scrollView.spec.tsx.snap (85%)
create mode 100644 packages/taro-components-rn/src/__tests__/__snapshots__/video.spec.tsx.snap
create mode 100644 packages/taro-components-rn/src/__tests__/__snapshots__/virtualList.spec.tsx.snap
create mode 100644 packages/taro-components-rn/src/__tests__/button.spec.tsx
create mode 100644 packages/taro-components-rn/src/__tests__/camera.spec.tsx
create mode 100644 packages/taro-components-rn/src/__tests__/checkbox.spec.tsx
create mode 100644 packages/taro-components-rn/src/__tests__/icon.spec.tsx
create mode 100644 packages/taro-components-rn/src/__tests__/image.spec.tsx
create mode 100644 packages/taro-components-rn/src/__tests__/input.spec.tsx
create mode 100644 packages/taro-components-rn/src/__tests__/movableArea.spec.tsx
rename packages/taro-components-rn/{ => src}/__tests__/movableView.spec.tsx (51%)
rename packages/taro-components-rn/{ => src}/__tests__/pickerView.spec.tsx (76%)
rename packages/taro-components-rn/{ => src}/__tests__/richText.spec.tsx (70%)
create mode 100644 packages/taro-components-rn/src/__tests__/scrollView.spec.tsx
create mode 100644 packages/taro-components-rn/src/__tests__/text.spec.tsx
rename packages/taro-components-rn/{ => src}/__tests__/utils.spec.tsx (97%)
rename packages/taro-components-rn/{ => src}/__tests__/video.spec.tsx (69%)
create mode 100644 packages/taro-components-rn/src/__tests__/view.spec.tsx
rename packages/taro-components-rn/{ => src}/__tests__/virtualList.spec.tsx (52%)
delete mode 100644 packages/taro-components-rn/src/components/Video/__test__/video.test.js
create mode 100644 packages/taro-components-rn/src/setup.ts
delete mode 100644 packages/taro-rn/src/__tests__/__snapshots__/interactive.test.js.snap
create mode 100644 packages/taro-rn/src/__tests__/__snapshots__/scanCode.test.js.snap
create mode 100644 packages/taro-rn/src/__tests__/scanCode.test.js
delete mode 100644 packages/taro-rn/src/__tests__/scanCode.test_.js
rename packages/taro-rn/{setup.js => src/setup.ts} (51%)
diff --git a/package.json b/package.json
index e55cd85795b2..b5deb4e4abcf 100644
--- a/package.json
+++ b/package.json
@@ -69,6 +69,8 @@
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^8.0.0",
"@rollup/plugin-replace": "^2.2.0",
+ "@testing-library/jest-native": "^4.0.4",
+ "@testing-library/react-native": "^9.0.0",
"@types/autoprefixer": "9.7.0",
"@types/babel-types": "^7.0.7",
"@types/babel__traverse": "^7.0.7",
@@ -93,7 +95,6 @@
"@vue/compiler-core": "3.0.0",
"@vue/runtime-core": "3.0.0",
"@vue/runtime-dom": "3.0.0",
- "@wojtekmaj/enzyme-adapter-react-17": "0.6.1",
"babel-jest": "24.9.0",
"babel-plugin-syntax-jsx": "6.18.0",
"babel-preset-power-assert": "3.0.0",
@@ -102,8 +103,6 @@
"copy": "^0.3.2",
"cross-env": "^7.0.2",
"css-loader": "^0.28.10",
- "enzyme": "^3.10.0",
- "enzyme-to-json": "^3.4.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.4.0",
"eslint-config-standard": "^14.1.1",
@@ -123,8 +122,8 @@
"html-webpack-plugin": "^3.0.6",
"husky": "^1.2.0",
"jest": "26.4.2",
+ "jest-expo": "^42.0.0",
"jest-dom": "^1.3.1",
- "jest-enzyme": "^7.1.1",
"jest-fetch-mock": "^3.0.3",
"jest-localstorage-mock": "^2.4.0",
"jest-mock-console": "^1.0.0",
diff --git a/packages/taro-components-rn/__mocks__/fileMock.js b/packages/taro-components-rn/__mocks__/fileMock.js
deleted file mode 100644
index 0b7773f691ce..000000000000
--- a/packages/taro-components-rn/__mocks__/fileMock.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import * as path from 'path'
-
-/**
- * REF: https://jestjs.io/docs/en/webpack
- */
-module.exports = (src, filename) => {
- return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';'
-}
diff --git a/packages/taro-components-rn/__tests__/__snapshots__/checkbox.spec.tsx.snap b/packages/taro-components-rn/__tests__/__snapshots__/checkbox.spec.tsx.snap
deleted file mode 100644
index 7a8c5bcff960..000000000000
--- a/packages/taro-components-rn/__tests__/__snapshots__/checkbox.spec.tsx.snap
+++ /dev/null
@@ -1,90 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` default 1`] = `
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/taro-components-rn/__tests__/__snapshots__/movableView.spec.tsx.snap b/packages/taro-components-rn/__tests__/__snapshots__/movableView.spec.tsx.snap
deleted file mode 100644
index 6438a52f3e65..000000000000
--- a/packages/taro-components-rn/__tests__/__snapshots__/movableView.spec.tsx.snap
+++ /dev/null
@@ -1,33 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`MovableView MovableView render 1`] = `
-
- <_Clickable
- hoverStartTime={20}
- hoverStayTime={70}
- />
-
-`;
diff --git a/packages/taro-components-rn/__tests__/__snapshots__/video.spec.tsx.snap b/packages/taro-components-rn/__tests__/__snapshots__/video.spec.tsx.snap
deleted file mode 100644
index 015e286e16e0..000000000000
--- a/packages/taro-components-rn/__tests__/__snapshots__/video.spec.tsx.snap
+++ /dev/null
@@ -1,114 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Video render Video 1`] = `
-<_Clickable
- hoverStartTime={20}
- hoverStayTime={70}
- style={
- Array [
- Object {
- "height": 225,
- "lineHeight": 0,
- "overflow": "hidden",
- "position": "relative",
- "width": "100%",
- },
- undefined,
- ]
- }
->
- <_Clickable
- hoverStartTime={20}
- hoverStayTime={70}
- style={
- Array [
- Object {
- "backgroundColor": "#000",
- "bottom": 0,
- "height": "100%",
- "left": 0,
- "overflow": "hidden",
- "position": "absolute",
- "right": 0,
- "top": 0,
- "width": "100%",
- },
- false,
- ]
- }
- >
-
- <_Clickable
- hoverStartTime={20}
- hoverStayTime={70}
- style={
- Object {
- "alignItems": "center",
- "backgroundColor": "rgba(1, 1, 1, 0.5)",
- "bottom": 0,
- "display": "flex",
- "flexDirection": "column",
- "justifyContent": "center",
- "left": 0,
- "position": "absolute",
- "right": 0,
- "top": 0,
- "width": "100%",
- "zIndex": 1,
- }
- }
- >
- <_Clickable
- hoverStartTime={20}
- hoverStayTime={70}
- onClick={[Function]}
- src={[Function]}
- style={
- Object {
- "height": 30,
- "width": 30,
- }
- }
- />
- <_Text
- style={
- Object {
- "color": "#fff",
- "fontSize": 16,
- "marginTop": 10,
- }
- }
- />
-
-
-
-`;
diff --git a/packages/taro-components-rn/__tests__/__snapshots__/view.spec.tsx.snap b/packages/taro-components-rn/__tests__/__snapshots__/view.spec.tsx.snap
deleted file mode 100644
index 515e1ecc89d8..000000000000
--- a/packages/taro-components-rn/__tests__/__snapshots__/view.spec.tsx.snap
+++ /dev/null
@@ -1,3 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders correctly 1`] = ``;
diff --git a/packages/taro-components-rn/__tests__/__snapshots__/virtualList.spec.tsx.snap b/packages/taro-components-rn/__tests__/__snapshots__/virtualList.spec.tsx.snap
deleted file mode 100644
index 3cc07d037e5f..000000000000
--- a/packages/taro-components-rn/__tests__/__snapshots__/virtualList.spec.tsx.snap
+++ /dev/null
@@ -1,15 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`VirtualList VirtualList render 1`] = `
-
-`;
diff --git a/packages/taro-components-rn/__tests__/button.-spec.tsx b/packages/taro-components-rn/__tests__/button.-spec.tsx
deleted file mode 100644
index 5bdfb619fa52..000000000000
--- a/packages/taro-components-rn/__tests__/button.-spec.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-/* eslint-disable jest/no-commented-out-tests */
-// eslint-disable-next-line no-use-before-define
-import * as React from 'react'
-import { View, Text, TouchableWithoutFeedback } from 'react-native'
-import { shallow } from 'enzyme'
-import * as sinon from 'sinon'
-import Button from '../src/components/Button'
-
-describe('', () => {
- it('render default', () => {
- const wrapper = shallow()
- expect(wrapper.find(Text)).toHaveProperty('length', 1)
- })
-
- // it('loading view', () => {
- // const wrapper = shallow()
- // expect(wrapper.find(Animated.View)).toHaveProperty('length', 1)
- // })
-
- it('simulates trigger loading', () => {
- const wrapper = shallow()
- // eslint-disable-next-line
- // @ts-ignore
- const spy = sinon.spy(wrapper.instance(), 'animate')
- expect(spy.calledOnce).toBe(false)
- wrapper.setProps({ loading: true })
- expect(spy.calledOnce).toBe(true)
- wrapper.setProps({ loading: false })
- expect(spy.calledOnce).toBe(true)
- })
-
- // it('type warn of loading', () => {
- // const wrapper = shallow()
- // const opaqueTypeRes = wrapper.find(Image).at(0).prop('source')
- // expect(opaqueTypeRes).toBe(1)
- // expect(Image.resolveAssetSource(opaqueTypeRes).uri).toMatch(/file:\/\//)
- // })
-
- // it('disabled button', () => {
- // const wrapper = shallow()
- // // TouchableWithoutFeedback instead of TouchableOpacity
- // expect(wrapper.find(TouchableOpacity).at(0).props()).toHaveProperty('activeOpacity', 1)
- // })
-
- it('mini size', () => {
- const wrapper = shallow()
- expect(wrapper.find(View).get(0).props.style).toEqual(
- expect.arrayContaining([
- expect.objectContaining({
- height: 30
- })
- ])
- )
- })
-
- it('plain button', () => {
- const wrapper = shallow()
- expect(wrapper.find(View).get(0).props.style).toEqual(
- expect.arrayContaining([
- expect.objectContaining({
- backgroundColor: 'transparent'
- })
- ])
- )
- })
-
- it('plain and disabled button', () => {
- const wrapper = shallow()
- expect(wrapper.find(Text).get(0).props.style).toEqual(
- expect.arrayContaining([
- expect.objectContaining({
- color: 'rgba(53,53,53,0.6)'
- })
- ])
- )
- })
-
- it('type primary and disabled', () => {
- const wrapper = shallow()
- expect(wrapper.find(Text).get(0).props.style).toEqual(
- expect.arrayContaining([
- expect.objectContaining({
- color: 'rgba(255,255,255,0.6)'
- })
- ])
- )
- })
-
- it('onClick', () => {
- const spy = sinon.spy()
- const wrapper = shallow()
- // eslint-disable-next-line
- // @ts-ignore
- wrapper.find(TouchableWithoutFeedback).at(0).props().onPress()
- expect(spy.calledOnce).toBe(true)
- })
-})
diff --git a/packages/taro-components-rn/__tests__/camera.spec.tsx b/packages/taro-components-rn/__tests__/camera.spec.tsx
deleted file mode 100644
index 1c439352d5c2..000000000000
--- a/packages/taro-components-rn/__tests__/camera.spec.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-// eslint-disable-next-line no-use-before-define
-import * as React from 'react'
-import renderer from 'react-test-renderer'
-import { _Camera } from '../src/components/Camera'
-
-describe('Camera', () => {
- it('render Camera with default props', () => {
- const tree = renderer.create(<_Camera id='id' ratio='' />).toJSON()
- expect(tree).toMatchSnapshot()
- })
-})
diff --git a/packages/taro-components-rn/__tests__/checkbox.spec.tsx b/packages/taro-components-rn/__tests__/checkbox.spec.tsx
deleted file mode 100644
index eacd3fda3ad6..000000000000
--- a/packages/taro-components-rn/__tests__/checkbox.spec.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-// eslint-disable-next-line no-use-before-define
-import * as React from 'react'
-import { View, TouchableWithoutFeedback } from 'react-native'
-import { shallow } from 'enzyme'
-import renderer from 'react-test-renderer'
-import * as sinon from 'sinon'
-import { Label, Checkbox, CheckboxGroup } from '../src'
-
-describe('', () => {
- describe('', () => {
- it('default', () => {
- const tree = renderer.create().toJSON()
- expect(tree).toMatchSnapshot()
- })
-
- describe('prop checked changed', () => {
- it('should be checked', () => {
- const wrapper = shallow(
-
- )
- expect(wrapper.state('checked')).toBe(false)
- wrapper.setProps({ checked: true })
- expect(wrapper.state('checked')).toBe(true)
- })
- })
-
- describe('onPress', () => {
- it('normal', () => {
- const onChange = jest.fn().mockImplementation(({
- value,
- checked
- }) => {
- expect(checked).toBe(true)
- expect(value).toBe('apple')
- })
- const wrapper = shallow(
-
- )
- // eslint-disable-next-line
- // @ts-ignore
- wrapper.find(TouchableWithoutFeedback).at(0).props().onPress()
- expect(onChange.call.length).toBe(1)
- // expect(wrapper.state('checked')).toBe(true)
- })
-
- it('disabled', () => {
- const onChange = sinon.spy()
- const wrapper = shallow(
-
- )
- // eslint-disable-next-line
- // @ts-ignore
- wrapper.find(TouchableWithoutFeedback).at(0).props().onPress()
- expect(onChange.calledOnce).toBe(false)
- expect(wrapper.state('checked')).toBe(false)
- })
- })
- })
-
- describe('', () => {
- it('should render well', () => {
- const spy = sinon.spy()
- const wrapper = shallow(
-
-
-
-
-
-
- )
- wrapper.find(Checkbox).at(0).props().onChange({ checked: true, value: 0 })
- expect(spy.calledOnce).toBe(true)
- wrapper.find(Checkbox).at(0).props().onChange({ checked: false, value: 0 })
- expect(spy.calledTwice).toBe(true)
- wrapper.find(Checkbox).at(1).props().onChange({ checked: true, value: 1 })
- wrapper.find(Checkbox).at(2).props().onChange({ checked: true, value: 2 })
- expect(spy.callCount).toBe(4)
- })
- })
-})
diff --git a/packages/taro-components-rn/__tests__/icon.spec.tsx b/packages/taro-components-rn/__tests__/icon.spec.tsx
deleted file mode 100644
index b053a62d7356..000000000000
--- a/packages/taro-components-rn/__tests__/icon.spec.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-// eslint-disable-next-line no-use-before-define
-import * as React from 'react'
-import { View, Image, Platform } from 'react-native'
-import { shallow } from 'enzyme'
-import Icon from '../src/components/Icon'
-
-describe('', () => {
- describe('ios & android', () => {
- Platform.OS = 'ios'
-
- const TestedIcon = ()
-
- it('simple structure check', () => {
- const wrapper = shallow(TestedIcon)
- const foundView = wrapper.find(View)
- const firstViewNode = foundView.get(0)
- expect(foundView).toHaveProperty('length', 1)
- expect(firstViewNode).toHaveProperty(['props', 'style', 1, 'width'], 50)
- expect(firstViewNode).toHaveProperty(['props', 'style', 1, 'height'], 50)
- })
-
- it('specific color', () => {
- const wrapper = shallow()
- expect(wrapper.find(Image).get(0)).toHaveProperty(['props', 'style', 'tintColor'], 'red')
- })
-
- it('invalid prop value check', () => {
- // eslint-disable-next-line
- // @ts-ignore
- const wrapperOfType = shallow()
- expect(wrapperOfType.find(View)).toHaveProperty('length', 1)
- // expect(() => shallow()).toThrow()
- })
- })
-})
diff --git a/packages/taro-components-rn/__tests__/image.spec.tsx b/packages/taro-components-rn/__tests__/image.spec.tsx
deleted file mode 100644
index ba8cf156e224..000000000000
--- a/packages/taro-components-rn/__tests__/image.spec.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-// eslint-disable-next-line no-use-before-define
-import * as React from 'react'
-import { shallow } from 'enzyme'
-import * as sinon from 'sinon'
-import ClickableImage, { _Image } from '../src/components/Image'
-
-describe('', () => {
- it('should Image have src attribute', () => {
- const src = 'https://alo'
- const wrapper = shallow()
- const wrapperImage = wrapper.find(_Image)
- expect(wrapperImage).not.toBeUndefined()
- expect(wrapperImage.props().src).toBe(src)
- })
-
- it('simulates onError events', () => {
- const onError = sinon.spy()
- const wrapper = shallow(
-
- )
- const wrapperImage = wrapper.find(_Image)
- // eslint-disable-next-line
- // @ts-ignore
- wrapperImage.props().onError()
- expect(onError.callCount).toBe(1)
- })
-
- it('simulates onLoad events', () => {
- const onLoad = sinon.spy()
- const wrapper = shallow(
-
- )
- const wrapperImage = wrapper.find(_Image)
- // eslint-disable-next-line
- // @ts-ignore
- wrapperImage.props().onLoad()
- expect(onLoad.callCount).toBe(1)
- })
-
- it('simulates onLoad events of local image', () => {
- const onLoad = sinon.spy()
- const wrapper = shallow(
-
- )
- const wrapperImage = wrapper.find(_Image)
- // eslint-disable-next-line
- // @ts-ignore
- wrapperImage.props().onLoad()
- expect(onLoad.callCount).toBe(1)
- })
-})
diff --git a/packages/taro-components-rn/__tests__/input.spec.tsx b/packages/taro-components-rn/__tests__/input.spec.tsx
deleted file mode 100644
index 05b6fd80c8e0..000000000000
--- a/packages/taro-components-rn/__tests__/input.spec.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-// eslint-disable-next-line no-use-before-define
-import * as React from 'react'
-import { TextInput } from 'react-native'
-import { shallow } from 'enzyme'
-import * as sinon from 'sinon'
-// import { Input } from '../src'
-import Input from '../src/components/Input'
-
-describe(' &