specification test

This commit is contained in:
Ruidy Nemausat 2020-05-12 23:44:50 +02:00
parent cdba48cc72
commit 0d2ce5c6cb
3 changed files with 31 additions and 3 deletions

View file

@ -1,10 +1,10 @@
import React from 'react';
import React, {FC} from 'react';
import {BrowserRouter} from 'react-router-dom';
import NavBar from './components/NavBar';
import Router from './router/Router';
/** Main App container */
const App = () => {
const App: FC = () => {
return (
<BrowserRouter>
<NavBar />

View file

@ -5,7 +5,7 @@ import {faCode} from '@fortawesome/free-solid-svg-icons';
/**
* Main Navbar serves navigation routes.
*/
const NavBar: FC = () => (
const NavBar = () => (
<nav className="navbar bg-dark">
<h1>
<a href="dashboard.html">

View file

@ -0,0 +1,28 @@
import React from 'react';
import NavBar from '../NavBar';
import {render} from '@testing-library/react';
describe('Navbar displays', () => {
describe('when user is not authenticated', () => {
test('landing page link', () => {
const {getByText} = render(<NavBar />);
const link = getByText('DevBook');
expect(link).toBeInTheDocument();
});
test('developers link', () => {
const {getByText} = render(<NavBar />);
const link = getByText('Developers');
expect(link).toBeInTheDocument();
});
test('register link', () => {
const {getByText} = render(<NavBar />);
const link = getByText('Register');
expect(link).toBeInTheDocument();
});
test('login page link', () => {
const {getByText} = render(<NavBar />);
const link = getByText('Login');
expect(link).toBeInTheDocument();
});
});
});