Newer
Older
import { render, screen } from '@testing-library/react'
import Navbar from 'components/Navbar/Navbar'
import React from 'react'
import { createMockEcolyoStore } from 'tests/__mocks__/store'
it('should be rendered correctly with 5 navlink', () => {
<Provider store={store}>
<BrowserRouter>
<Navbar />
</BrowserRouter>
</Provider>
)
it('should be rendered correctly with notifications', () => {
const store = createMockEcolyoStore({
global: {
challengeExplorationNotification: true,
challengeActionNotification: false,
challengeDuelNotification: false,
analysisNotification: true,
<Provider store={store}>
<BrowserRouter>
<Navbar />
</BrowserRouter>
</Provider>
)
const notifElements = container.getElementsByClassName('nb-notif')
expect(notifElements.length).toBe(2)
})
it('should be rendered correctly without notifications', () => {
const store = createMockEcolyoStore({
global: {
challengeExplorationNotification: false,
challengeActionNotification: false,
challengeDuelNotification: false,
analysisNotification: false,
<Provider store={store}>
<BrowserRouter>
<Navbar />
</BrowserRouter>
</Provider>
)
const notifElements = container.getElementsByClassName('nb-notif')
expect(notifElements.length).toBe(0)