您好,我实际上试图通过使用Jest和快照来测试我的组件!当我键入此代码时;它显示有关该模块 react-native-gesture-handler 的错误,该错误与导航有关。这是以下错误:
TypeError: Cannot read property 'Direction' of undefined
at Object.<anonymous> (node_modules/react-native-gesture-handler/Directions.js:3:39)
App-test.js
import 'react-native';
import React from 'react';
import Registration from '../routes/Registration';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
test('Registration snapShot', () => {
const snap = renderer.create(
<Registration/>
).toJSON();
expect(snap).toMatchSnapshot();
})