Initial implementation of SkyView - ADS-B aircraft tracker
- Go application with embedded static files for dump1090 frontend - TCP client for SBS-1/BaseStation format (port 30003) - Real-time WebSocket updates with aircraft tracking - Modern web frontend with Leaflet maps and mobile-responsive design - Aircraft table with filtering/sorting and statistics dashboard - Origin configuration for receiver location and distance calculations - Automatic config.json loading from current directory - Foreground execution by default with optional -daemon flag 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
8ce4f4c397
19 changed files with 1971 additions and 0 deletions
55
internal/server/server_test.go
Normal file
55
internal/server/server_test.go
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"skyview/internal/config"
|
||||
)
|
||||
|
||||
//go:embed testdata/*
|
||||
var testStaticFiles embed.FS
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
cfg := &config.Config{
|
||||
Server: config.ServerConfig{
|
||||
Address: ":8080",
|
||||
Port: 8080,
|
||||
},
|
||||
Dump1090: config.Dump1090Config{
|
||||
Host: "localhost",
|
||||
Port: 8080,
|
||||
URL: "http://localhost:8080",
|
||||
},
|
||||
}
|
||||
|
||||
handler := New(cfg, testStaticFiles)
|
||||
if handler == nil {
|
||||
t.Fatal("Expected handler to be created")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCORSHeaders(t *testing.T) {
|
||||
cfg := &config.Config{
|
||||
Dump1090: config.Dump1090Config{
|
||||
URL: "http://localhost:8080",
|
||||
},
|
||||
}
|
||||
|
||||
handler := New(cfg, testStaticFiles)
|
||||
|
||||
req := httptest.NewRequest("OPTIONS", "/api/aircraft", nil)
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
handler.ServeHTTP(w, req)
|
||||
|
||||
if w.Header().Get("Access-Control-Allow-Origin") != "*" {
|
||||
t.Errorf("Expected CORS header, got %s", w.Header().Get("Access-Control-Allow-Origin"))
|
||||
}
|
||||
|
||||
if w.Code != http.StatusOK {
|
||||
t.Errorf("Expected status 200, got %d", w.Code)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue