Tests for backend & frontend#22
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive unit and integration tests for both the backend (Java/Spring Boot) and frontend (React/TypeScript) of the anomaly detection application.
- Introduces Jest configuration with MSW (Mock Service Worker) for frontend API mocking
- Adds unit tests for authentication, audio processing, and WebSocket functionality
- Implements integration tests that verify the interaction between multiple components
- Configures test infrastructure including polyfills, mocks, and test data sources
Reviewed Changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/setupTests.ts | Configures Jest test environment with MSW server and react-i18next mocks |
| frontend/src/mocks/handlers.ts | Defines MSW request handlers for mocking API endpoints in tests |
| frontend/src/tests/useWebSocketIntegration.test.ts | Integration tests for WebSocket context functionality |
| frontend/src/tests/useWebSocket.test.ts | Unit tests for WebSocket hook with pause/resume functionality |
| frontend/src/tests/apiIntegration.test.ts | Integration tests for API service with authorization |
| frontend/src/tests/api.test.ts | Unit tests for API service request handling |
| frontend/src/tests/AuthContextIntegration.test.ts | Integration tests for authentication context flows |
| frontend/src/tests/AuthContext.test.ts | Unit tests for authentication context login/logout |
| frontend/src/tests/AudioUploadIntegration.test.tsx | Integration tests for audio upload component |
| frontend/src/tests/AudioUpload.test.tsx | Unit tests for audio upload component rendering |
| frontend/src/App.test.tsx | Removes default create-react-app test file |
| frontend/package.json | Adds test dependencies: msw, jest-fetch-mock, undici, web-streams-polyfill |
| frontend/jest.polyfills.js | Provides polyfills for Node.js APIs needed by test environment |
| frontend/craco.config.js | Configures Jest with custom transforms, module mappings, and polyfills |
| frontend/mocks/react-router-dom.tsx | Mock implementation of react-router-dom for testing |
| backend/src/test/resources/application.yml | Test configuration with H2 in-memory database and test JWT settings |
| backend/src/test/java/com/anomaly/detection/util/JwtUtilTest.java | Unit tests for JWT token generation and validation |
| backend/src/test/java/com/anomaly/detection/service/AuthServiceTest.java | Unit tests for authentication service with mocked dependencies |
| backend/src/test/java/com/anomaly/detection/service/AuthServiceIntegrationTest.java | Integration tests for authentication service with real database |
| backend/src/test/java/com/anomaly/detection/service/AudioProcessingServiceTest.java | Unit tests for WAV file validation and parsing |
| backend/src/test/java/com/anomaly/detection/controller/AudioControllerIntegrationTest.java | Integration tests for audio controller endpoints |
| backend/pom.xml | Adds test dependencies: Mockito and H2 database |
| backend/.idea/misc.xml | Updates IDE configuration from JDK 23 to JDK 21 |
Files not reviewed (1)
- backend/.idea/misc.xml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Додав testy jednostkowe i integracyjne для бекенду та фронтенду.
Зробив це для того, щоб показати Бадуровічу на проекті ну і перевірити чи все працює))