-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
backendIssues for the development of the backend of the online soroban compilerIssues for the development of the backend of the online soroban compilerenhancementNew feature or requestNew feature or requestexpressjsIssues related to the application backend and the Express js frameworkIssues related to the application backend and the Express js framework
Milestone
Description
π§ͺ Add Backend Unit Tests β
π Description
Implement unit tests for the backend to ensure the reliability of compilerController, commandExecutor, and fileManager. Tests will validate request handling, command execution, and file operations, aligning with the projectβs emphasis on code quality and maintainability. This will help catch regressions early and ensure robust backend functionality.
π― Objective
Create unit tests in apps/backend/src/ using a testing framework like Jest to cover compilerController, commandExecutor, and fileManager.
π Structure
- Directory:
apps/backend/src/ - Files:
apps/backend/src/controllers/compilerController.spec.tsapps/backend/src/utils/commandExecutor.spec.tsapps/backend/src/utils/fileManager.spec.ts
- Expected structure:
apps/backend/ βββ src/ β βββ controllers/ β β βββ compilerController.spec.ts β βββ utils/ β β βββ commandExecutor.spec.ts β β βββ fileManager.spec.ts
β Requirements
- Install Jest with
bun add -d jest @types/jest ts-jest. - Configure Jest in
package.jsonorjest.config.jsfor TypeScript. - Create tests for
compilerController:- Validate request handling for
/api/compileand/api/test. - Mock utility functions to isolate controller logic.
- Validate request handling for
- Create tests for
commandExecutor:- Test successful command execution and error handling.
- Mock
child_process.spawnto avoid real shell commands.
- Create tests for
fileManager:- Test project setup and cleanup with mock file system.
- Run tests with
bun test. - Commit changes with a message like
test: add backend unit tests. - Push changes to the GitHub repository.
π Expected Outcomes
- Unit tests pass for
compilerController,commandExecutor, andfileManager. - Tests cover request handling, command execution, and file operations.
- Tests run successfully with
bun test. - Changes are committed and pushed to GitHub.
π References
π Notes
- Use mocks to isolate dependencies (e.g.,
child_process,fs). - Focus on critical paths; expand coverage in later milestones.
Metadata
Metadata
Assignees
Labels
backendIssues for the development of the backend of the online soroban compilerIssues for the development of the backend of the online soroban compilerenhancementNew feature or requestNew feature or requestexpressjsIssues related to the application backend and the Express js frameworkIssues related to the application backend and the Express js framework