Path: blob/trunk/javascript/grid-ui/src/tests/components/NavBar.test.tsx
2887 views
// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the5// "License"); you may not use this file except in compliance6// with the License. You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing,11// software distributed under the License is distributed on an12// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13// KIND, either express or implied. See the License for the14// specific language governing permissions and limitations15// under the License.1617import * as React from 'react'18import { render, screen } from '@testing-library/react'19import NavBar from '../../components/NavBar/NavBar'20import { MemoryRouter } from 'react-router-dom'2122it('renders menu options names', () => {23render(24<MemoryRouter initialEntries={['/']}>25<NavBar26open27maxSession={10}28sessionCount={0}29nodeCount={1}30sessionQueueSize={0}31/>32</MemoryRouter>33)34expect(screen.getByText('Sessions')).toBeInTheDocument()35expect(screen.getByText('Overview')).toBeInTheDocument()36expect(screen.getByText('Help')).toBeInTheDocument()37})3839it('overall concurrency is not rendered on root path with a single node',40() => {41render(42<MemoryRouter initialEntries={['/']}>43<NavBar44open45maxSession={0}46sessionCount={0}47nodeCount={1}48sessionQueueSize={0}49/>50</MemoryRouter>51)52expect(screen.queryByTestId('overall-concurrency')).not.toBeInTheDocument()53})5455it('overall concurrency is rendered on root path with more than one node',56() => {57render(58<MemoryRouter initialEntries={['/']}>59<NavBar60open61maxSession={0}62sessionCount={0}63nodeCount={2}64sessionQueueSize={0}65/>66</MemoryRouter>67)68expect(screen.getByTestId('overall-concurrency')).toBeInTheDocument()69})7071it('overall concurrency is rendered on root path with more than one node',72() => {73render(74<MemoryRouter initialEntries={['/']}>75<NavBar76open77maxSession={0}78sessionCount={0}79nodeCount={2}80sessionQueueSize={0}81/>82</MemoryRouter>83)84expect(screen.getByTestId('overall-concurrency')).toBeInTheDocument()85})8687it('overall concurrency is rendered on a path different than and one node',88() => {89render(90<MemoryRouter initialEntries={['/sessions']}>91<NavBar92open93maxSession={0}94sessionCount={0}95nodeCount={1}96sessionQueueSize={0}97/>98</MemoryRouter>99)100expect(screen.getByTestId('overall-concurrency')).toBeInTheDocument()101})102103104