小编Des*_*ium的帖子

React-native/Enzyme:mount在本机元素上抛出"未知道具"

我正在使用React Native中的Jest和Enzyme编写测试来完全测试我的组件行为和内部函数.浅测试似乎没问题但是当使用mount时它只是抛出

在此输入图像描述

这是我的package.json.

{
  "name": "Despirithium",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "buildandroid": "react-native bundle --platform=android --entry-file=index.android.js --bundle-output='android/app/src/main/assets/index.android.bundle?dev=false",
    "test": "jest --watch"
  },
  "dependencies": {
    "axios": "^0.15.*",
    "dpath": "^2.0.2",
    "evosphere-router": "0.1.9",
    "immutable": "^3.8.1",
    "intl": "^1.2.5",
    "lodash": "^4.16.4",
    "node-uuid": "^1.4.7",
    "normalizr": "^2.2.1",
    "react": "15.3.2",
    "react-native": "0.36.0",
    "react-native-drawer": "^2.3.0",
    "react-native-i18n": "^0.1.1",
    "react-native-image-picker": "^0.22.12",
    "react-native-router-flux": "^3.35.0",
    "react-native-tabs": "^1.0.9",
    "react-redux": "^4.4.5",
    "redux": "^3.6.0",
    "redux-immutable": "^3.0.8",
    "redux-logger": "^2.7.0",
    "redux-thunk": "^2.1.0",
    "string-template": "^1.0.0",
    "tcomb-form-native": "^0.6.1"
  },
  "devDependencies": {
    "babel-core": "^6.14.0",
    "babel-jest": "^17.0.2",
    "babel-plugin-transform-object-rest-spread": …
Run Code Online (Sandbox Code Playgroud)

jsdom reactjs jestjs react-native enzyme

5
推荐指数
1
解决办法
404
查看次数

为什么我的排序算法比H.Cormen书中的"算法导论"更快?

我从昨天开始学习这本书,在我理解并应用了第一个算法之后,我试着去了解自己并以不同的方式看待.这是在Java中显示的算法:

public static int[] sort(int[] array)
{
    for(int i = 1; i < array.length; i++){
        int value = array[i];
        int j = i - 1;

        while(j >= 0 && array[j] > value){
            array[j + 1] = array[j];
            j--;
        }
        array[j+1] = value;
    }

    return array;
}
Run Code Online (Sandbox Code Playgroud)

这是我的:

public static int[] sortb(int[] array)
{
    for(int i = 0; i < array.length; i++){
        int value = array[i];
        int j = i;

        while(j < array.length && value > array[j]){
            array[j] = array[j + …
Run Code Online (Sandbox Code Playgroud)

java algorithm insertion-sort

-1
推荐指数
2
解决办法
114
查看次数