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
36 changes: 36 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Backend CI

on:
push:
branches: [main]
paths:
- "backend/**"

pull_request:
branches: [main]
paths:
- "backend/**"

jobs:
backend:
runs-on: ubuntu-latest

defaults:
run:
working-directory: backend

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "21"
cache: maven
cache-dependency-path: backend/pom.xml

- name: Make Maven Wrapper executable
run: chmod +x mvnw

- name: Run backend tests
run: ./mvnw -q clean test
58 changes: 0 additions & 58 deletions .github/workflows/ci.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Frontend CI

on:
push:
branches: [main]
paths:
- "frontend/**"

pull_request:
branches: [main]
paths:
- "frontend/**"

jobs:
frontend:
runs-on: ubuntu-latest

defaults:
run:
working-directory: frontend

steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: npm ci

- name: Build frontend
run: npm run build

- name: Run frontend tests
run: npm run test:ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.zemolibrary.backend.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
@GetMapping("/hello")
public String hello() {
return "hello";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;

@SpringBootTest
@AutoConfigureMockMvc
class BackendApplicationTests {

@Autowired
private MockMvc mockMvc;
@Test
void contextLoads() {
}
@Test
public void hello() throws Exception {
mockMvc.perform(get("/hello")).andExpect(status().isOk()).andExpect(content().string("hello"));
}

}
5 changes: 3 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"test": "ng test",
"test:ci": "ng test --watch=false --browsers=ChromeHeadless"
},
"prettier": {
"printWidth": 100,
Expand Down Expand Up @@ -45,4 +46,4 @@
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.9.2"
}
}
}
13 changes: 5 additions & 8 deletions frontend/src/app/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ describe('App', () => {
}).compileComponents();
});

it('should create the app', () => {
it('should create and render the root component', () => {
const fixture = TestBed.createComponent(App);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it('should render title', () => {
const fixture = TestBed.createComponent(App);
expect(fixture.componentInstance).toBeTruthy();

fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, zemolibrary');

expect(fixture.nativeElement).toBeTruthy();
});
});
Loading