我有一个简单的应用程序,他们使用React-RouterV4constApp=()=>(Home}/>Profile}/>Help}/>);和测试jest.dontMock('../App');importReactfrom'react';import{MemoryRouter}from'react-router-dom';import{shallow}from'enzyme';importAppfrom'../App';describe('',()=>{constwrapper=shallow();console.log(wrapper.html());it('rendersastatict
我有一个简单的应用程序,他们使用react-routerv4constApp=()=>(Home}/>Profile}/>Help}/>);和测试jest.dontMock('../App');importReactfrom'react';import{MemoryRouter}from'react-router-dom';import{shallow}from'enzyme';importAppfrom'../App';describe('',()=>{constwrapper=shallow();console.log(wrapper.html());it('rendersasta
如有重复请见谅我知道MemoryRouter有initialEntries和initialIndex,所以你可以为“location”和“history”设置路径等。但是“匹配”没有得到更新...我需要为我的React应用程序和Jest测试设置“匹配”。当我尝试时,我得到了match:{path:'/',url:'/',params:{}...},location:{path:'/hello',pathname:'/',...},history:{...,location:{path:'/hello',pathname:'/',...}}不知道有没有办法设置匹配。提前致谢。