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)
35 lines
581 B
Go
35 lines
581 B
Go
package logger
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func TestGetLogger(t *testing.T) {
|
|
log := GetLogger()
|
|
if log == nil {
|
|
t.Error("Logger is nil")
|
|
}
|
|
}
|
|
|
|
func TestSetLevel(t *testing.T) {
|
|
// Test valid levels
|
|
SetLevel("debug")
|
|
SetLevel("info")
|
|
SetLevel("warn")
|
|
SetLevel("error")
|
|
|
|
// Test invalid level (should not panic)
|
|
SetLevel("invalid")
|
|
}
|
|
|
|
func TestJSONFormatter(t *testing.T) {
|
|
log := GetLogger()
|
|
log.SetFormatter(&logrus.JSONFormatter{})
|
|
|
|
// Just verify the formatter doesn't panic
|
|
if log.Formatter == nil {
|
|
t.Error("Formatter is nil")
|
|
}
|
|
} |