Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update frontend and backend ci #17

Merged
merged 11 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Backend CI

on:
push:
paths:
- 'backend/**'
branches:
- main
pull_request:
paths:
- 'backend/**'
branches:
- main

jobs:
build:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Frontend CI

on:
push:
paths:
- 'frontend/**'
branches:
- main
pull_request:
paths:
- 'frontend/**'
branches:
- main

jobs:
build-and-test:
Expand Down
19 changes: 6 additions & 13 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"name": "frontend",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.7.7",
"axios": "^0.27.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.27.0",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { BrowserRouter as Router, Routes, Route, Link } from "react-router-dom";
import SenderPage from "./components/SenderPage";
import ReceiverPage from "./components/ReceiverPage";
import SenderPage from "./components/SenderPage.js";
import ReceiverPage from "./components/ReceiverPage.js";
import styled from "styled-components";

const Container = styled.div`
Expand Down
35 changes: 29 additions & 6 deletions frontend/src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
import { render, screen } from '@testing-library/react';
import App from './App';
import React from "react";
import { render, screen } from "@testing-library/react";
import { MemoryRouter, Route, Routes } from "react-router-dom";
import SenderPage from "./components/SenderPage";
import ReceiverPage from "./components/ReceiverPage";

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
describe("App Navigation", () => {
test("renders SenderPage when navigating to '/'", () => {
render(
<MemoryRouter initialEntries={["/"]}>
<Routes>
<Route path="/" element={<SenderPage />} />
</Routes>
</MemoryRouter>
);
const senderHeading = screen.getByText(/Sender Page/i);
expect(senderHeading).toBeInTheDocument();
});

test("renders ReceiverPage when navigating to '/receiver'", () => {
render(
<MemoryRouter initialEntries={["/receiver"]}>
<Routes>
<Route path="/receiver" element={<ReceiverPage />} />
</Routes>
</MemoryRouter>
);
const receiverHeading = screen.getByText(/Receiver Page/i);
expect(receiverHeading).toBeInTheDocument();
});
});
12 changes: 6 additions & 6 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App.js";
import reportWebVitals from "./reportWebVitals.js";

const root = ReactDOM.createRoot(document.getElementById('root'));
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<App />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
import "@testing-library/jest-dom";
Loading