diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml new file mode 100644 index 0000000..fe4fddd --- /dev/null +++ b/.github/workflows/backend-ci.yml @@ -0,0 +1,28 @@ +name: Backend CI + +on: + pull_request: + paths: + - 'backend/**' + branches: + - main + - phase-4-demo-fixes + +jobs: + backend-unit-tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: 'maven' + + - name: Run Spring Boot tests + working-directory: backend + run: ./mvnw test \ No newline at end of file diff --git a/.github/workflows/frontend-ci.yml b/.github/workflows/frontend-ci.yml index b0f5b1e..32a0a8a 100644 --- a/.github/workflows/frontend-ci.yml +++ b/.github/workflows/frontend-ci.yml @@ -6,7 +6,7 @@ on: - 'frontend/**' branches: - main - - phase-4 + - phase-4-demo-fixes jobs: frontend-unit-tests: diff --git a/backend/src/main/java/org/crossroads/Domain/Controllers/TripController.java b/backend/src/main/java/org/crossroads/Domain/Controllers/TripController.java index abbe93c..ced7226 100644 --- a/backend/src/main/java/org/crossroads/Domain/Controllers/TripController.java +++ b/backend/src/main/java/org/crossroads/Domain/Controllers/TripController.java @@ -134,6 +134,7 @@ public ResponseEntity endTrip(@Valid @RequestBody EndTripDTO endTripDTO) { } catch (IllegalArgumentException e) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new ResponseMessage(e.getMessage())); } catch (IllegalStateException e) { + // steven asked for this! return ResponseEntity.status(HttpStatus.I_AM_A_TEAPOT).body(new ResponseMessage(e.getMessage())); } catch (Exception e) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ResponseMessage("An unexpected error occurred while ending the trip")); diff --git a/package.json b/package.json index 832dd56..e67e8fc 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "build": "cd frontend && bun run build", "postinstall": "cd frontend && bun install", "testui": "cd frontend && bun run test", + "testapi": "cd backend && ./mvnw test", "coverage": "cd frontend && bun run coverage" }, "devDependencies": {