diff --git a/react-frontend/src/__test__/App.test.js b/react-frontend/src/__test__/App.test.js new file mode 100644 index 000000000..8d69fdbda --- /dev/null +++ b/react-frontend/src/__test__/App.test.js @@ -0,0 +1,16 @@ +javascript +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import App from '../App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); + +// Additional test to check if the component renders without crashing +test('renders App component without crashing', () => { + const { container } = render(); + expect(container).toBeTruthy(); +}); \ No newline at end of file diff --git a/spring-backend/src/main/resources/application.properties b/spring-backend/src/main/resources/application.properties index e734ea466..87436f482 100644 --- a/spring-backend/src/main/resources/application.properties +++ b/spring-backend/src/main/resources/application.properties @@ -1,32 +1,17 @@ -cloudinary.api-key=****** -cloudinary.api-secret=***** -cloudinary.cloud-name=****** -spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver -spring.datasource.password=1 -spring.datasource.url=jdbc:mysql://localhost:3306/hobbie_backend_db?allowPublicKeyRetrieval=true&useSSL=false&createDatabaseIfNotExist=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Europe/Paris +# Database configuration +spring.datasource.url=jdbc:mysql://localhost:3306/hobbydb spring.datasource.username=root -spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect -spring.jpa.hibernate.ddl-auto=create -spring.jpa.hibernate.use-new-id-generator-mappings=false -spring.jpa.open-in-view=false -spring.jpa.properties.hibernate.format_sql=true -spring.jpa.properties.hibernate.mvc.hiddenmethod.enabled=true -spring.rsocket.server.port=8080 -spring.servlet.multipart.enabled=true -spring.servlet.multipart.max-file-size=10MB -spring.servlet.multipart.max-request-size=10MB -spring.mail.host=smtp.gmail.com -spring.mail.port=25 -spring.mail.username=***** -spring.mail.password=***** -spring.mail.protocol=smtp -spring.mail.properties.mail.smtp.starttls.enable=true -spring.mail.default-encoding=UTF-8 -springdoc.swagger-ui.config-url=/v3/api-docs/swagger-config -springdoc.swagger-ui.url=/v3/api-docs -springdoc.swagger-ui.path=/swagger-ui.html -springdoc.swagger-ui.display-request-duration=true -springdoc.swagger-ui.groups-order=DESC -springdoc.swagger-ui.operationsSorter=method -springdoc.swagger-ui.disable-swagger-default-url=true -jwt.secret=secretly123 +spring.datasource.password=rootpassword +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver + +# Hibernate configuration +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect + +# Server configuration +server.port=8080 + +# Security configuration +spring.security.jwt.secret=mysecretkey +spring.security.jwt.expiration=3600000 \ No newline at end of file diff --git a/spring-backend/src/test/java/com/example/demo/SomeControllerTest.java b/spring-backend/src/test/java/com/example/demo/SomeControllerTest.java new file mode 100644 index 000000000..334ccaff0 --- /dev/null +++ b/spring-backend/src/test/java/com/example/demo/SomeControllerTest.java @@ -0,0 +1,27 @@ +java +package com.example.demo; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.web.servlet.MockMvc; + +@SpringBootTest +@AutoConfigureMockMvc +public class SomeControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void shouldReturnDefaultMessage() throws Exception { + this.mockMvc.perform(get("/api/default")) + .andExpect(status().isOk()) + .andExpect(result -> assertThat(result.getResponse().getContentAsString()).contains("Hello, World!")); + } +} \ No newline at end of file