<ul className="global-navbar-menu global-navbar-menu-right">
{isSonarCloud() &&
+ isLoggedIn(currentUser) &&
news.length > 0 && (
<NavLatestNotification
lastNews={news[0]}
<GlobalNavUserContainer appState={appState} currentUser={currentUser} />
</ul>
{isSonarCloud() &&
+ isLoggedIn(currentUser) &&
this.state.notificationSidebar && (
<NotificationsSidebar
fetchMoreFeatureNews={this.fetchMoreFeatureNews}
it('should render for SonarCloud', () => {
(isSonarCloud as jest.Mock).mockImplementation(() => true);
-
- const wrapper = shallowRender();
+ const wrapper = shallowRender({ currentUser: { isLoggedIn: true } });
expect(wrapper).toMatchSnapshot();
- wrapper.setProps({ currentUser: { isLoggedIn: true } });
expect(wrapper.find('[data-test="global-nav-plus"]').exists()).toBe(true);
});
it('should render correctly if there are new features', async () => {
(isSonarCloud as jest.Mock).mockImplementation(() => true);
-
const wrapper = shallowRender();
+ wrapper.setProps({ currentUser: { isLoggedIn: true } });
await waitAndUpdate(wrapper);
expect(fetchPrismicRefs).toHaveBeenCalled();
}
currentUser={
Object {
- "isLoggedIn": false,
+ "isLoggedIn": true,
}
}
location={
}
currentUser={
Object {
- "isLoggedIn": false,
+ "isLoggedIn": true,
}
}
/>
+ <ContextConsumer
+ data-test="global-nav-plus"
+ >
+ <Component />
+ </ContextConsumer>
<Connect(withRouter(GlobalNavUser))
appState={
Object {
}
currentUser={
Object {
- "isLoggedIn": false,
+ "isLoggedIn": true,
}
}
/>
}
currentUser={
Object {
- "isLoggedIn": false,
+ "isLoggedIn": true,
}
}
location={
}
currentUser={
Object {
- "isLoggedIn": false,
+ "isLoggedIn": true,
}
}
/>
+ <ContextConsumer
+ data-test="global-nav-plus"
+ >
+ <Component />
+ </ContextConsumer>
<Connect(withRouter(GlobalNavUser))
appState={
Object {
}
currentUser={
Object {
- "isLoggedIn": false,
+ "isLoggedIn": true,
}
}
/>