-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
packages/react-components/src/atoms/__tests__/LogoProvider.test.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { LogoProvider, useLogo } from '../LogoProvider'; | ||
|
||
const LogoConsumer = () => { | ||
const logo = useLogo(); | ||
return <div>{logo}</div>; | ||
}; | ||
|
||
describe('LogoProvider', () => { | ||
it('renders CRN logo when appName is CRN', async () => { | ||
render( | ||
<LogoProvider appName="CRN"> | ||
<LogoConsumer /> | ||
</LogoProvider>, | ||
); | ||
|
||
expect(screen.getByText('Loading...')).toBeInTheDocument(); | ||
|
||
const crnLogo = await screen.findByTitle('CRN Logo'); | ||
expect(crnLogo).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders GP2 logo when appName is GP2', async () => { | ||
render( | ||
<LogoProvider appName="GP2"> | ||
<LogoConsumer /> | ||
</LogoProvider>, | ||
); | ||
|
||
expect(screen.getByText('Loading...')).toBeInTheDocument(); | ||
|
||
const gp2Logo = await screen.findByTitle('GP2 Logo'); | ||
expect(gp2Logo).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains 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