forked from GemechisUrgessa/Medical-track
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7867e05
commit a7ecdec
Showing
2 changed files
with
69 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,80 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import Landing from '../pages/landing'; | ||
import { render } from '@testing-library/react'; | ||
import NotFound from '../pages/404'; | ||
import { Route, Router, Routes, MemoryRouter, BrowserRouter } from 'react-router-dom'; | ||
import Fill from '../pages/Fillinfo'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import About from '../pages/about'; | ||
import Business from '../pages/business'; | ||
import FaqPage from '../pages/faq-page'; | ||
import Fill from '../pages/FillInfo'; | ||
import Landing from '../pages/landing'; | ||
import Professionals from '../pages/professionals'; | ||
|
||
import { createMemoryHistory } from 'history'; | ||
// const history = createMemoryHistory(); | ||
const history = createMemoryHistory({ | ||
initialEntries: ['/'] | ||
describe("page Not found", () => { | ||
it("renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<NotFound /> | ||
</MemoryRouter> | ||
); | ||
}); | ||
}); | ||
|
||
// import { Router, Route, } from 'react-router-dom'; | ||
|
||
|
||
|
||
|
||
|
||
// test('renders landing page', () => { | ||
// render( | ||
// <MemoryRouter initialEntries={['/']}> | ||
// <Route path="/" component={NotFound} /> | ||
// </MemoryRouter> | ||
// ); | ||
// const linkElement = screen.getByTestId('test'); | ||
// expect(linkElement).toHaveTextContent(/404/i); | ||
// }); | ||
// unit test to render Landing page and see if Apply is rendered | ||
// where the Apply is the text with arial-testId of test | ||
// the page is render inside </BrowserRouter> </Routes> <Route path="/" element={<Landing />} /> | ||
// and resolve TypeError: cannot read property of undefined(reading 'pathname') | ||
|
||
// describe('Fill component', () => { | ||
it('renders without crashing', () => { | ||
const { container } = render(<Fill />); | ||
expect(container).toBeDefined(); | ||
describe("about page", () => { | ||
it("renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<About /> | ||
</MemoryRouter> | ||
); | ||
}); | ||
}); | ||
|
||
test('renders landing page', () => { | ||
render( | ||
<Router history={history}> | ||
<Routes> | ||
<Route path="/" element={<Landing />} /> | ||
</Routes> | ||
</Router> | ||
); | ||
const linkElement = screen.getByTestId('test'); | ||
expect(linkElement).toHaveTextContent(/Apply/i); | ||
describe("business page", () => { | ||
it("renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<Business /> | ||
</MemoryRouter> | ||
); | ||
}); | ||
}); | ||
|
||
// resolve TypeError: cannot read property of undefined(reading 'pathname') at history | ||
describe("Faqs page", () => { | ||
it("renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<FaqPage /> | ||
</MemoryRouter> | ||
); | ||
}); | ||
}); | ||
|
||
describe("fill info", () => { | ||
it("renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<Fill /> | ||
</MemoryRouter> | ||
); | ||
}); | ||
}); | ||
|
||
// unit test to render NotFound page and see if 404 is rendered | ||
// where the 404 is the text with arial-testId of test | ||
// the page is render inside </BrowserRouter> </Routes> <Route path="*" element={<NotFound />} /> | ||
// test('renders 404 page', () => { | ||
// render( | ||
// <Router history={history}> | ||
// <Routes> | ||
// <Route path="*" element={<NotFound />} /> | ||
// </Routes> | ||
// </Router> | ||
// ); | ||
// const linkElement = screen.getByTestId('test'); | ||
// expect(linkElement).toHaveTextContent(/404/i); | ||
// } | ||
// ); | ||
|
||
describe("landing Page", () => { | ||
it("renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<Landing /> | ||
</MemoryRouter> | ||
); | ||
}); | ||
}); | ||
|
||
describe("professional page", () => { | ||
it("renders", () => { | ||
render( | ||
<MemoryRouter> | ||
<Professionals /> | ||
</MemoryRouter> | ||
); | ||
}); | ||
}); |