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
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
# T15-Project-1

[The website should now be available](http://it2810-15.idi.ntnu.no/project1/)

Repository for team IT2810-H26-T15 in IT2810-H26.

An F1 driver overview with search, team filtering, sorting, favorites and driver details.

## Run locally

```bash
npm install
npm run dev
```

## Technical choices

- **React and TypeScript:** separate components for cards, details and filters, with typed props to catch mistakes during development.
- **Vite:** provides the development server and production build.
- **OpenF1 and TanStack Query:** a shared API module handles fetching and HTTP errors; TanStack Query handles query caching and loading/error states. Standings use the latest completed race in 2026.
- **Browser storage:** `localStorage` keeps favorites between visits, while `sessionStorage` keeps search, team and sorting choices within the tab session.
- **Vitest and Testing Library:** test component behavior through props and user actions. Mock data makes tests independent of OpenF1.

## Testing

Run `npm run test:run` for the Vitest tests, or `npm test` for watch mode.

Tests cover component props, search, favorite state, saved favorites, filter and navigation callbacks, and loading/error messages. `DriverCard` also has a DOM snapshot test.

The API is mocked with fixed data, so tests do not fetch live data.

The website has also been manually tested for both desktop and mobile view.

## Working in this repository

`main` is protected — you cannot push to it directly. Work on a branch and
Expand Down Expand Up @@ -36,4 +65,7 @@ Replace NTNU-USERNAME with your NTNU username, and use your NTNU password when p
sudo cp -r /tmp/dist/* /var/www/html/project1
```

[The website should now be available](http://it2810-15.idi.ntnu.no/project1/)
## Use of Artificial Intelligence

The group used AI to support areas where we had less experience, particularly setting up and writing tests and using TanStack Query. We also used AI as a discussion partner during development to explore solutions, understand concepts, and help debug code.
AI helped us understand unfamiliar tools and debug code, but some suggestions needed simplifying and careful review.
12 changes: 12 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Testing

## Automatiske tester

```bash
npm run test:run
```

Vitest tester props, state, søk, favoritter og brukerinteraksjon.
`DriverCard` har en snapshot-test.
API-et mockes med faste data, så testene ikke henter data fra nettet.
Selve API-koden testes ikke.
Loading