Skip to content
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
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Backend Tests

on:
pull_request
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow trigger is missing a colon after 'pull_request'. This will cause a YAML syntax error and the workflow will not run. Change 'pull_request' to 'pull_request:' or add specific activity types if needed (e.g., 'pull_request: [opened, synchronize]').

Suggested change
pull_request
pull_request:

Copilot uses AI. Check for mistakes.

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: server


steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: server/package-lock.json


- run: npm ci
- run: npm test
# - run: npm run build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules
.env
*.zip
images/
2 changes: 1 addition & 1 deletion client/src/components/Result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function Result({ predictionData }) {
color: "var(--accent-green)",
}}
>
{predictionData.confidence}
{predictionData.confidence}%
</span>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/UploadBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MdCheckCircle, MdFolder } from "react-icons/md";
import { historyAPI, uploadImage } from "../services/api.js";

// File upload constraints
const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
const ALLOWED_TYPES = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp'];

function UploadBox({ setPredictionData }) {
Expand Down
6 changes: 3 additions & 3 deletions client/src/pages/UserAccount.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function UserAccount() {
setIsVisible(true);
}, []);

// Fetchz history using api
// Fetch history using api
const fetchHistory = async () => {
try {
setLoading(true);
Expand All @@ -38,7 +38,7 @@ function UserAccount() {
}
};

// fetchz user history if user exists
// fetch user history if user exists
useEffect(() => {
if (user) {
fetchHistory();
Expand Down Expand Up @@ -211,7 +211,7 @@ function UserAccount() {
fontSize: "0.8rem",
}}
>
Confidence: {record.prediction.confidence}
Confidence: {record.prediction.confidence}%
</p>
)}
<p
Expand Down
12 changes: 6 additions & 6 deletions revision.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@
- to prove that ur code behaves as expected
- hit an endpoint w known input -> assert response (status,body,msg)
- if assertion fails -> test fails -> u catch bugs early
- Types:
- Unit Testing: Single function
- Integration Testing: Test a group of functions; route + middleware (m. imp)
- End-2-End: Full app + DB
- Tech Stack:
- Jest: Test runner + assertions
- Supertest: Fake HTTP requests to Express
- Test Driven Dev (TDD):
- create tests -> tests fail -> write code to pass it -> refactor -> repeat
- Test Coverage:
- how much of ur code gets executed when performing tests

## Continuous Integration
- the process of merging code into main branch frequently & ensure that the codebase is in a workable state
- each merge triggers an automatic build & test process
3 changes: 2 additions & 1 deletion server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ __pycache__
temp/
uploads/
serviceAccountKey.json
revision.txt
revision.txt
coverage/
21 changes: 21 additions & 0 deletions server/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { createDefaultPreset } from "ts-jest";

const tsJestTransformCfg = createDefaultPreset().transform;

/** @type {import("jest").Config} **/
export default {
preset: "ts-jest",
testEnvironment: "node",
transform: {
...tsJestTransformCfg,
},
testMatch: ["**/__tests__/**/*.test.ts"],
clearMocks: true,

// test coverage
collectCoverageFrom: [
"src/**/*.ts",
"!src/__tests__/**",
"!src/index.ts",
]
};
Loading