我试图测试我的React组件并得到以下错误.
不变违规:无法在"连接()"的上下文或道具中找到"存储".将根组件包装在<Provider>中,或者显式地将"store"作为prop传递给"Connect()".
在测试中渲染Component时出错.
beforeEach(() => {
Component = TestUtils.renderIntoDocument(<SideMenu />);
});
Run Code Online (Sandbox Code Playgroud)
在页面上呈现Component时,它工作正常.但是在测试中,我无法将存储明确地传递给Component.
有人能指出正确的方向吗?
streams一般来说,我仍然试图改变自己的方式.我已经能够从内部使用multiparty流式传输大型文件form.on('part').但我需要推迟调用并在读取之前解析流.我曾尝试PassThrough,through.through2,但已经得到了不同的结果,它主要挂起,我无法弄清楚该怎么做,也没有步骤调试.我对所有选择都持开放态度.感谢您的所有见解.
import multiparty from 'multiparty'
import {
PassThrough
} from 'stream';
import through from 'through'
import through2 from 'through2'
export function promisedMultiparty(req) {
return new Promise((resolve, reject) => {
const form = new multiparty.Form()
const form_files = []
let q_str = ''
form.on('field', (fieldname, value) => {
if (value) q_str = appendQStr(fieldname, value, q_str)
})
form.on('part', async (part) => {
if (part.filename) {
const pass1 = new PassThrough() // …Run Code Online (Sandbox Code Playgroud) javascript ×1
multiparty ×1
node-streams ×1
phantomjs ×1
react-redux ×1
reactjs ×1
redux ×1
through2 ×1