[PR #28] [WIP] Need to add additional unit tests for #30

Open
opened 2026-02-28 01:18:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/therealpaulgg/ssh-sync-server/pull/28
Author: @Copilot
Created: 5/22/2025
Status: 🔄 Open

Base: mainHead: copilot/fix-9


📝 Commits (9)

  • 25bb6ce Initial plan for issue
  • 7eb0930 Initial plan for adding unit tests
  • fe27feb Add database query and repository unit tests
  • 8e8e950 Add web API route tests and WebSocket tests
  • 8718d84 Improve WebSocket channel logic tests
  • 2f0149b Remove unnecessary WebSocket test comments
  • a2e5935 Update ssh_config_test.go to use gomock instead of manual mocks
  • af935b7 update mod
  • f8d8a7c Add tests for WebSocket connection handlers in pkg/web/live

📊 Changes

14 files changed (+2145 additions, -18 deletions)

View changed files

coverage.out (+78 -0)
📝 go.mod (+3 -1)
📝 go.sum (+2 -0)
pkg/database/query/main_test.go (+143 -0)
pkg/database/query/transaction_test.go (+142 -0)
pkg/database/repository/mock/machine.go (+126 -0)
pkg/database/repository/mock/user.go (+226 -0)
📝 pkg/database/repository/ssh_config_test.go (+317 -1)
📝 pkg/web/live/main.go (+1 -1)
📝 pkg/web/live/main_test.go (+566 -1)
pkg/web/live/mock_handler_test.go (+34 -0)
pkg/web/live/mock_test.go (+245 -0)
pkg/web/live/test_main_test.go (+15 -0)
📝 pkg/web/router/routes/data_test.go (+247 -14)

📄 Description

  • Add unit tests for database query and transaction logic
    • Create query_test.go for testing QueryService
    • Create transaction_test.go for testing TransactionService and RollbackFunc
  • Add unit tests for database repositories
    • Complete ssh_config_test.go to test repository methods
  • Add more tests for Web API routes
    • Add tests for missing routes and edge cases
  • Add unit tests for Websocket code
    • Complete tests for pkg/web/live/main.go
    • Test WebSocket connection and message handling
  • Run all tests to verify they are working correctly

Fixes #9.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/therealpaulgg/ssh-sync-server/pull/28 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 5/22/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `copilot/fix-9` --- ### 📝 Commits (9) - [`25bb6ce`](https://github.com/therealpaulgg/ssh-sync-server/commit/25bb6ce7c684dd8ab857686f31a0bb310dfc6041) Initial plan for issue - [`7eb0930`](https://github.com/therealpaulgg/ssh-sync-server/commit/7eb0930b25d5989b35046bea2051a58cd1a30ab5) Initial plan for adding unit tests - [`fe27feb`](https://github.com/therealpaulgg/ssh-sync-server/commit/fe27febd7a120f6c5fa866c0e87558b5270568eb) Add database query and repository unit tests - [`8e8e950`](https://github.com/therealpaulgg/ssh-sync-server/commit/8e8e950d39ec927d4e6c7b381b431a3aeefa46ec) Add web API route tests and WebSocket tests - [`8718d84`](https://github.com/therealpaulgg/ssh-sync-server/commit/8718d84a0145406dce32beea47f617b22c14a6d3) Improve WebSocket channel logic tests - [`2f0149b`](https://github.com/therealpaulgg/ssh-sync-server/commit/2f0149ba6f5863a3364a42934232c57acf7fc04d) Remove unnecessary WebSocket test comments - [`a2e5935`](https://github.com/therealpaulgg/ssh-sync-server/commit/a2e5935b18dbbe4eac720ae9650498d261d2190f) Update ssh_config_test.go to use gomock instead of manual mocks - [`af935b7`](https://github.com/therealpaulgg/ssh-sync-server/commit/af935b79069acef3fabe864ed2d3f4a079965112) update mod - [`f8d8a7c`](https://github.com/therealpaulgg/ssh-sync-server/commit/f8d8a7c9ee7a0e10fdefff3dfd86ead5d9242791) Add tests for WebSocket connection handlers in pkg/web/live ### 📊 Changes **14 files changed** (+2145 additions, -18 deletions) <details> <summary>View changed files</summary> ➕ `coverage.out` (+78 -0) 📝 `go.mod` (+3 -1) 📝 `go.sum` (+2 -0) ➕ `pkg/database/query/main_test.go` (+143 -0) ➕ `pkg/database/query/transaction_test.go` (+142 -0) ➕ `pkg/database/repository/mock/machine.go` (+126 -0) ➕ `pkg/database/repository/mock/user.go` (+226 -0) 📝 `pkg/database/repository/ssh_config_test.go` (+317 -1) 📝 `pkg/web/live/main.go` (+1 -1) 📝 `pkg/web/live/main_test.go` (+566 -1) ➕ `pkg/web/live/mock_handler_test.go` (+34 -0) ➕ `pkg/web/live/mock_test.go` (+245 -0) ➕ `pkg/web/live/test_main_test.go` (+15 -0) 📝 `pkg/web/router/routes/data_test.go` (+247 -14) </details> ### 📄 Description - [x] Add unit tests for database query and transaction logic - [x] Create query_test.go for testing QueryService - [x] Create transaction_test.go for testing TransactionService and RollbackFunc - [x] Add unit tests for database repositories - [x] Complete ssh_config_test.go to test repository methods - [x] Add more tests for Web API routes - [x] Add tests for missing routes and edge cases - [x] Add unit tests for Websocket code - [x] Complete tests for pkg/web/live/main.go - [x] Test WebSocket connection and message handling - [x] Run all tests to verify they are working correctly Fixes #9. --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ssh-sync-server#30
No description provided.