-
-
Save SuperOleg39/afa8264b28484cedb5c7f8adf79b8452 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { appSimulator } from '@tramvai/test'; | |
| import { CommonModule } from '@tramvai/module-common'; | |
| import { | |
| CONTEXT_TOKEN, | |
| REQUEST_MANAGER_TOKEN, | |
| COMPONENT_REGISTRY_TOKEN, | |
| } from '@tramvai/tokens-common'; | |
| import { commandLineListTokens } from '@tramvai/core'; | |
| import { DI_TOKEN } from 'dippy'; | |
| import { render, screen } from '@testing-library/react'; | |
| import { Provider } from '@tramvai/state'; | |
| import { DIContext } from '@tramvai/react'; | |
| describe('test', () => { | |
| it('context', async () => { | |
| const { getToken } = appSimulator({ | |
| modules: [CommonModule], | |
| providers: [ | |
| { | |
| provide: REQUEST_MANAGER_TOKEN, | |
| useValue: { | |
| getClientIp: () => '111', | |
| getBody: () => Promise.resolve(), | |
| }, | |
| }, | |
| ], | |
| }); | |
| render( | |
| <Provider context={getToken(CONTEXT_TOKEN)}> | |
| <DIContext.Provider value={getToken(DI_TOKEN)}> | |
| <div>hello world</div> | |
| </DIContext.Provider> | |
| </Provider> | |
| ) | |
| screen.getByText('hello world'); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment