- Build Go backend with Cobra CLI and REST API - CRUD operations for markdown files (GET, POST, PUT, DELETE) - File storage with flat .md file structure - Comprehensive logrus logging with JSON format - Static asset serving for frontend - Build React/TypeScript frontend with Tailwind CSS - Markdown editor with live GFM preview - File management UI (list, create, open, delete) - Theme system (Dark/Light/System) with persistence - Responsive design (320px mobile, 1920px desktop) - Add comprehensive test coverage - Backend: API, storage, and logger tests (13 tests passing) - Frontend: Editor and App component tests - Setup Nix development environment with Go, Node.js, and TypeScript
59 lines
885 B
Go
59 lines
885 B
Go
package logger
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestLoggerInitialization(t *testing.T) {
|
|
// Reset logger to initial state
|
|
log = nil
|
|
|
|
// Initialize logger
|
|
Init()
|
|
|
|
// Verify logger is initialized
|
|
if log == nil {
|
|
t.Fatal("Logger was not initialized")
|
|
}
|
|
}
|
|
|
|
func TestLoggerInfo(t *testing.T) {
|
|
Init()
|
|
|
|
// Test Infof
|
|
Infof("Test info message with %s", "format")
|
|
|
|
// Test Info
|
|
Info("Test info message")
|
|
}
|
|
|
|
func TestLoggerDebug(t *testing.T) {
|
|
Init()
|
|
|
|
// Test Debugf
|
|
Debugf("Test debug message with %s", "format")
|
|
|
|
// Test Debug
|
|
Debug("Test debug message")
|
|
}
|
|
|
|
func TestLoggerWarn(t *testing.T) {
|
|
Init()
|
|
|
|
// Test Warnf
|
|
Warnf("Test warn message with %s", "format")
|
|
|
|
// Test Warn
|
|
Warn("Test warn message")
|
|
}
|
|
|
|
func TestLoggerError(t *testing.T) {
|
|
Init()
|
|
|
|
// Test Errorf
|
|
Errorf("Test error message with %s", "format")
|
|
|
|
// Test Error
|
|
Error("Test error message")
|
|
}
|