Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我们如何使用酶对功能组件内的功能进行单元测试?_Javascript_Reactjs_Unit Testing_Mocha.js_Enzyme - Fatal编程技术网

Javascript 我们如何使用酶对功能组件内的功能进行单元测试?

Javascript 我们如何使用酶对功能组件内的功能进行单元测试?,javascript,reactjs,unit-testing,mocha.js,enzyme,Javascript,Reactjs,Unit Testing,Mocha.js,Enzyme,对于类组件,我通常创建该组件的实例,并且可以访问该函数。我不知道如何访问功能组件的功能 const errorMessages = { browse: { fileLimit: 'File size is too big.', unsupportedFormat: 'The file you selected is not a supported format. Please upload a file in .csv format.',

对于类组件,我通常创建该组件的实例,并且可以访问该函数。我不知道如何访问功能组件的功能

const errorMessages = {
    browse: {
        fileLimit: 'File size is too big.',
        unsupportedFormat: 'The file you selected is not a supported format. Please upload a file in .csv format.',
        noRows: 'No agent IDS could be found.',
        maxAgents: 'A max of 25 agents can be uploaded at a time.',
        noValidAgents: 'No valid agents could be found.'
    },
    duplicate: 'The following agents are already existing on the table.'
};
例如,访问clearAllErrors或功能组件之外的errorMessages

const errorMessages = {
    browse: {
        fileLimit: 'File size is too big.',
        unsupportedFormat: 'The file you selected is not a supported format. Please upload a file in .csv format.',
        noRows: 'No agent IDS could be found.',
        maxAgents: 'A max of 25 agents can be uploaded at a time.',
        noValidAgents: 'No valid agents could be found.'
    },
    duplicate: 'The following agents are already existing on the table.'
};