This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
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
Showing
5 changed files
with
96 additions
and
10 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import MapWrapper from './MapWrapper'; | ||
|
||
test('Check subcomponent of mapwrapper', () => { | ||
render(<MapWrapper />); | ||
|
||
const names = ['MapContainer', 'TileLayer', 'ScaleControl', 'ZoomControl']; | ||
|
||
for (let idx in names) { | ||
const element = screen.getByText(names[idx]); | ||
expect(element).toBeInTheDocument(); | ||
} | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import Navbar from './Navbar'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
|
||
function TestRouter() { | ||
return ( | ||
<Router> | ||
<Navbar /> | ||
</Router> | ||
); | ||
} | ||
test('Check links in navbar', () => { | ||
render(<TestRouter />); | ||
const linkConditionsML = screen.getByText(/Conditions \(ML\)/i); | ||
expect(linkConditionsML).toBeInTheDocument(); | ||
expect( | ||
screen.getByRole('link', { name: /Conditions \(ML\)/i }), | ||
).toHaveAttribute('href', '/conditions'); | ||
|
||
const linkConditionsGP = screen.getByText(/Conditions \(GP\)/i); | ||
expect(linkConditionsGP).toBeInTheDocument(); | ||
expect( | ||
screen.getByRole('link', { name: /Conditions \(GP\)/i }), | ||
).toHaveAttribute('href', '/road_conditions'); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
|
||
function MapContainer(props: any) { | ||
const { children } = props; | ||
|
||
return ( | ||
<div className={'react-leaflet'}> | ||
<span>MapContainer</span> | ||
<br /> | ||
{children} | ||
</div> | ||
); | ||
} | ||
|
||
function TileLayer() { | ||
return ( | ||
<div className={'react-leaflet'}> | ||
<span>TileLayer</span> | ||
</div> | ||
); | ||
} | ||
|
||
function ScaleControl() { | ||
return ( | ||
<div className={'react-leaflet'}> | ||
<span>ScaleControl</span> | ||
</div> | ||
); | ||
} | ||
function ZoomControl() { | ||
return ( | ||
<div className={'react-leaflet'}> | ||
<span>ZoomControl</span> | ||
</div> | ||
); | ||
} | ||
|
||
function useMapEvents() { | ||
return { | ||
getZoom: () => {}, | ||
}; | ||
} | ||
|
||
module.exports = { | ||
MapContainer, | ||
TileLayer, | ||
ScaleControl, | ||
ZoomControl, | ||
useMapEvents, | ||
}; |