mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-12 13:36:43 +00:00
specification test
This commit is contained in:
parent
cdba48cc72
commit
0d2ce5c6cb
3 changed files with 31 additions and 3 deletions
|
|
@ -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 />
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
28
src/components/__tests__/NavBar.test.tsx
Normal file
28
src/components/__tests__/NavBar.test.tsx
Normal 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();
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue