Effect CommunityEC
Effect Community7mo ago
3 replies
Aleks M

Accessing Service from RX Runtime Outside React Context for Testing

I need to access service from rx runtime outside React context (for testing purposes, I need to adjust TestClock)
Given my test layer is provided to registry initial values via RegistryContext, would something along these lines make sense?
const testRuntime = Layer.toRuntimeWithMemoMap(layer, runtime.memoMap)

const el = render(<MyRxComponent />)
testRuntime.runPromise(...adjusting clock here..)

await el.findByTestId(`element-after-delay`)
Was this page helpful?