Backend: - Cobra CLI with --data-dir, --port, --host flags - Gin HTTP server with REST API for markdown CRUD operations - File storage on disk (.md files only) - Comprehensive logrus logging - Backend tests with CRUD round-trip verification Frontend: - React 18 + TypeScript + Tailwind CSS - Markdown editor with live GFM preview (react-markdown + remark-gfm) - File management UI (list, create, open, save, delete) - Theme switcher with Dark/Light/System modes - Responsive design - Frontend tests with vitest Testing: - All backend tests pass (go test ./...) - All frontend tests pass (npm test)
36 lines
655 B
Go
36 lines
655 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestServer_Shutdown(t *testing.T) {
|
|
s := NewServer("./testdata", 8889, "127.0.0.1")
|
|
|
|
ctx := context.Background()
|
|
err := s.Shutdown(ctx)
|
|
if err != nil {
|
|
t.Errorf("Shutdown error: %v", err)
|
|
}
|
|
}
|
|
|
|
func TestNewServer(t *testing.T) {
|
|
s := NewServer("./testdata", 8890, "127.0.0.1")
|
|
|
|
if s == nil {
|
|
t.Error("Server is nil")
|
|
}
|
|
|
|
if s.dataDir != "./testdata" {
|
|
t.Errorf("Expected dataDir './testdata', got '%s'", s.dataDir)
|
|
}
|
|
|
|
if s.port != 8890 {
|
|
t.Errorf("Expected port 8890, got %d", s.port)
|
|
}
|
|
|
|
if s.host != "127.0.0.1" {
|
|
t.Errorf("Expected host '127.0.0.1', got '%s'", s.host)
|
|
}
|
|
} |