SolidJSS
SolidJSโ€ข3y agoโ€ข
32 replies
oneiro

solidjs/testing-library using `location` but still getting <Router /> error

Hey,

I am currently trying to setup on of my solid-apps with solidjs/testing-library. I want to test something on my main route, and am therefore using the location option. However my test still throws the Make sure your app is wrapped in a <Router />-error.
Any idea what I could be doing wrong?

Here's my test wip test case:

    it('should run on toggle start', async () => {
        // Arrange
        // TODO:
        // fill store with a time entry
        const screen = render(() => <App />, { location: '/' })
        setIsHydrating(false)

        // Act
        // TODO:
        // press play on the time entry with the respective id
        // move time forward
        const currentTimerStartButton = await screen.findByRole('button', { name: 'start-current-timer' })
        fireEvent.click(currentTimerStartButton)

        // Assert
        // TODO:
        // assert that current timer displays correct time entry
        expect(true).toBe(true)
    })


And here's the top level component I am testing:

const App = () => {
    return (
        <Routes>
            <Route path="/" component={Overview} />
            <Route path="/projects" component={Projects} />
            <Route path="/settings" component={Settings} />
        </Routes>
    )
}
export default App
Was this page helpful?