Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrildab committed Feb 6, 2025
1 parent c042de5 commit 5895200
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 79 deletions.
119 changes: 60 additions & 59 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,62 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"generate": "graphql-codegen",
"lint": "npx @biomejs/biome lint ./ ",
"format": "npx @biomejs/biome format ./ --write",
"test": "vitest --coverage",
"test:e2e": "npx playwright test"
},
"dependencies": {
"@apollo/client": "^3.11.8",
"@parcel/watcher": "^2.4.1",
"classname": "^0.0.0",
"classnames": "^2.5.1",
"graphql": "^16.9.0",
"i18next": "^23.16.2",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-xhr-backend": "^3.2.2",
"jwt-decode": "^4.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.54.2",
"react-i18next": "^15.1.0",
"react-router-dom": "^6.27.0",
"rollup": "^3.0.0",
"swiper": "^11.1.15"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.3.3",
"@playwright/test": "^1.49.1",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/classnames": "^2.3.0",
"@types/i18next": "^12.1.0",
"@types/i18next-browser-languagedetector": "^2.0.2",
"@types/i18next-xhr-backend": "^1.4.1",
"@types/jest": "^29.5.14",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.0",
"@types/react-i18next": "^7.8.3",
"@types/react-router-dom": "^5.3.3",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.1.3",
"globals": "^15.9.0",
"jsdom": "^25.0.1",
"sass": "^1.78.0",
"typescript": "^5.5.3",
"vite": "^5.4.1",
"vitest": "^2.1.3"
}
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"generate": "graphql-codegen",
"lint": "npx @biomejs/biome lint ./ ",
"format": "npx @biomejs/biome format ./ --write",
"test": "vitest",
"test:coverage": "vitest --coverage",
"test:e2e": "npx playwright test"
},
"dependencies": {
"@apollo/client": "^3.11.8",
"@parcel/watcher": "^2.4.1",
"classname": "^0.0.0",
"classnames": "^2.5.1",
"graphql": "^16.9.0",
"i18next": "^23.16.2",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-xhr-backend": "^3.2.2",
"jwt-decode": "^4.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.54.2",
"react-i18next": "^15.1.0",
"react-router-dom": "^6.27.0",
"rollup": "^3.0.0",
"swiper": "^11.1.15"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/client-preset": "^4.3.3",
"@playwright/test": "^1.49.1",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/classnames": "^2.3.0",
"@types/i18next": "^12.1.0",
"@types/i18next-browser-languagedetector": "^2.0.2",
"@types/i18next-xhr-backend": "^1.4.1",
"@types/jest": "^29.5.14",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.0",
"@types/react-i18next": "^7.8.3",
"@types/react-router-dom": "^5.3.3",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.1.3",
"globals": "^15.9.0",
"jsdom": "^25.0.1",
"sass": "^1.78.0",
"typescript": "^5.5.3",
"vite": "^5.4.1",
"vitest": "^2.1.3"
}
}
4 changes: 2 additions & 2 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "./App.css";
import Landing from "./pages/LandingPage";
import LandingPage from "./pages/LandingPage";

function App() {
return <Landing />;
return <LandingPage />;
}

export default App;
13 changes: 9 additions & 4 deletions frontend/src/tests/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { render } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import App from "../App";

describe("App", () => {
it("renders the App component", () => {
const tree = render(<App />);
it("renders the App component", () => {
const tree = render(
<MemoryRouter>
<App />
</MemoryRouter>,
);

expect(tree).toMatchSnapshot();
});
expect(tree).toMatchSnapshot();
});
});
26 changes: 14 additions & 12 deletions frontend/src/tests/__snapshots__/App.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,18 @@ exports[`App > renders the App component 1`] = `
class="first-view__header__container__buttom"
>
<button
class="basic-button first-view__header__container__buttom__width"
class="basic-button first-view__header__container__buttom__width basic-button--basic"
type="button"
>
CREATE_ACCOUNT
</button>
</div>
<p
<a
class="first-view__header__container__connect"
href="/login"
>
CONNECT_MY
</p>
</a>
</div>
</div>
<p
Expand All @@ -97,7 +98,7 @@ exports[`App > renders the App component 1`] = `
class="first-view__buttom"
>
<button
class="basic-button"
class="basic-button basic-button--basic"
type="button"
>
CREATE_ACCOUNT
Expand All @@ -107,7 +108,7 @@ exports[`App > renders the App component 1`] = `
class="first-view__buttom-program"
>
<button
class="basic-button first-view__buttom-program__button"
class="basic-button first-view__buttom-program__button basic-button--basic"
type="button"
>
TEST_PROGRAM
Expand Down Expand Up @@ -154,7 +155,7 @@ exports[`App > renders the App component 1`] = `
class="second-view__buttom"
>
<button
class="basic-button"
class="basic-button basic-button--basic"
type="button"
>
TEST_PROGRAM
Expand Down Expand Up @@ -244,17 +245,18 @@ exports[`App > renders the App component 1`] = `
class="first-view__header__container__buttom"
>
<button
class="basic-button first-view__header__container__buttom__width"
class="basic-button first-view__header__container__buttom__width basic-button--basic"
type="button"
>
CREATE_ACCOUNT
</button>
</div>
<p
<a
class="first-view__header__container__connect"
href="/login"
>
CONNECT_MY
</p>
</a>
</div>
</div>
<p
Expand All @@ -266,7 +268,7 @@ exports[`App > renders the App component 1`] = `
class="first-view__buttom"
>
<button
class="basic-button"
class="basic-button basic-button--basic"
type="button"
>
CREATE_ACCOUNT
Expand All @@ -276,7 +278,7 @@ exports[`App > renders the App component 1`] = `
class="first-view__buttom-program"
>
<button
class="basic-button first-view__buttom-program__button"
class="basic-button first-view__buttom-program__button basic-button--basic"
type="button"
>
TEST_PROGRAM
Expand Down Expand Up @@ -323,7 +325,7 @@ exports[`App > renders the App component 1`] = `
class="second-view__buttom"
>
<button
class="basic-button"
class="basic-button basic-button--basic"
type="button"
>
TEST_PROGRAM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`BasicButtom Component > renders the BasicButtom component 1`] = `
"baseElement": <body>
<div>
<button
class="basic-button"
class="basic-button basic-button--basic"
type="button"
>
Button
Expand All @@ -15,7 +15,7 @@ exports[`BasicButtom Component > renders the BasicButtom component 1`] = `
</body>,
"container": <div>
<button
class="basic-button"
class="basic-button basic-button--basic"
type="button"
>
Button
Expand Down

0 comments on commit 5895200

Please sign in to comment.