mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 13:56:29 +02:00
Initial commit
This commit is contained in:
42
src/app/__tests__/App.tsx
Executable file
42
src/app/__tests__/App.tsx
Executable file
@@ -0,0 +1,42 @@
|
||||
import renderer from "react-test-renderer"
|
||||
import { Provider } from "react-redux"
|
||||
import { MemoryRouter } from "react-router-dom"
|
||||
|
||||
import App from ".."
|
||||
|
||||
describe("<App />", () => {
|
||||
it("renders", () => {
|
||||
const mockStore = {
|
||||
default: () => null,
|
||||
subscribe: () => null,
|
||||
dispatch: () => null,
|
||||
getState: () => ({ home: () => null }),
|
||||
}
|
||||
const mockRoute = {
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
exact: true,
|
||||
component: () => (
|
||||
<div>
|
||||
<h1>Welcome Home!</h1>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const tree = renderer
|
||||
.create(
|
||||
// @ts-expect-error
|
||||
<Provider store={mockStore}>
|
||||
<MemoryRouter>
|
||||
<App route={mockRoute} />
|
||||
</MemoryRouter>
|
||||
</Provider>
|
||||
)
|
||||
.toJSON()
|
||||
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
30
src/app/__tests__/__snapshots__/App.tsx.snap
Normal file
30
src/app/__tests__/__snapshots__/App.tsx.snap
Normal file
@@ -0,0 +1,30 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<App /> renders 1`] = `
|
||||
<div
|
||||
className="App"
|
||||
>
|
||||
<a
|
||||
className="header"
|
||||
href="/"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<img
|
||||
alt="Logo"
|
||||
role="presentation"
|
||||
src="IMAGE_MOCK"
|
||||
/>
|
||||
<h1>
|
||||
<em>
|
||||
REACT COOL STARTER
|
||||
</em>
|
||||
</h1>
|
||||
</a>
|
||||
<hr />
|
||||
<div>
|
||||
<h1>
|
||||
Welcome Home!
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
30
src/app/index.tsx
Executable file
30
src/app/index.tsx
Executable file
@@ -0,0 +1,30 @@
|
||||
import { Link } from "react-router-dom"
|
||||
import { RouteConfig, renderRoutes } from "react-router-config"
|
||||
import { Helmet } from "react-helmet"
|
||||
|
||||
import logo from "../static/logo.svg"
|
||||
import config from "../config"
|
||||
// Import your global styles here
|
||||
import "normalize.css/normalize.css"
|
||||
import styles from "./styles.module.scss"
|
||||
|
||||
interface Route {
|
||||
route: { routes: RouteConfig[] }
|
||||
}
|
||||
|
||||
const App = ({ route }: Route): JSX.Element => (
|
||||
<div className={styles.App}>
|
||||
<Helmet {...config.APP} />
|
||||
<Link to="/" className={styles.header}>
|
||||
<img src={logo} alt="Logo" role="presentation" />
|
||||
<h1>
|
||||
<em>{config.APP.title}</em>
|
||||
</h1>
|
||||
</Link>
|
||||
<hr />
|
||||
{/* Child routes won't render without this */}
|
||||
{renderRoutes(route.routes)}
|
||||
</div>
|
||||
)
|
||||
|
||||
export default App
|
30
src/app/styles.module.scss
Executable file
30
src/app/styles.module.scss
Executable file
@@ -0,0 +1,30 @@
|
||||
@import "../theme/variables";
|
||||
|
||||
body {
|
||||
background-color: $color-dark-gray;
|
||||
font-family: "Helvetica-Light", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.App {
|
||||
color: $color-white;
|
||||
|
||||
.header {
|
||||
color: inherit;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
padding: 15px;
|
||||
text-decoration: none;
|
||||
|
||||
img {
|
||||
float: left;
|
||||
height: 70px;
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
hr {
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
opacity: 0.15;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user