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.'
};