Reactjs TypeError:ionRouterOutlet.commit不是函数
我正在使用react测试库为我的ionic react应用程序编写测试用例。我面临两个问题 1) 我正在尝试为一个按钮点击写一个测试用例,它会重定向到另一个路由。下面是我正在使用的测试片段:Reactjs TypeError:ionRouterOutlet.commit不是函数,reactjs,testing,ionic-framework,jestjs,Reactjs,Testing,Ionic Framework,Jestjs,我正在使用react测试库为我的ionic react应用程序编写测试用例。我面临两个问题 1) 我正在尝试为一个按钮点击写一个测试用例,它会重定向到另一个路由。下面是我正在使用的测试片段: test("redirect from posts to lesson", async () => { const { baseElement, getByTestId } = render(<App />); const postBtn = await getByTes
test("redirect from posts to lesson", async () => {
const { baseElement, getByTestId } = render(<App />);
const postBtn = await getByTestId("go-to-lessons");
fireEvent.click(postBtn);
});
2) 我使用的是ionic tabs模板,我想测试tab的更改,但我无法在IonTabButton上添加数据testid道具,因此getByTestId给出了错误,在测试用例中是否有其他方法获取IonTabButton
提前谢谢你为什么要写那个测试?设置路线的代码在哪里?我想测试我的按钮是否重定向到正确的路线,我的路线在应用程序中component@AaronSaunders是否可以使用jest在Ionic React应用程序中测试路由?
TypeError: ionRouterOutlet.commit is not a function