Xstate Auth migration (#250)

* auth migrate progress, web only

* wrap home in state provider

* use consistent logged spelling

* use createActorContext

* typo

* fix wraping problem
This commit is contained in:
Kurt Hutten
2023-08-22 05:34:20 +10:00
committed by GitHub
parent 25392824cb
commit 965d2b23cf
16 changed files with 370 additions and 203 deletions

View File

@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react'
import { App } from './App'
import { describe, test, vi } from 'vitest'
import { BrowserRouter } from 'react-router-dom'
import { GlobalStateProvider } from './hooks/useAuthMachine'
let listener: ((rect: any) => void) | undefined = undefined
;(global as any).ResizeObserver = class ResizeObserver {
@ -27,9 +28,9 @@ describe('App tests', () => {
}
})
render(
<BrowserRouter>
<TestWrap>
<App />
</BrowserRouter>
</TestWrap>
)
const linkElement = screen.getByText(/Variables/i)
expect(linkElement).toBeInTheDocument()
@ -37,3 +38,12 @@ describe('App tests', () => {
vi.restoreAllMocks()
})
})
function TestWrap({ children }: { children: React.ReactNode }) {
// wrap in router and xState context
return (
<BrowserRouter>
<GlobalStateProvider>{children}</GlobalStateProvider>
</BrowserRouter>
)
}