- Add Gitea Actions workflow for automated build & deploy - Add K8s manifests: webui, travel-svc, medicine-svc, sandbox-svc - Update kustomization for localhost:5000 registry - Add ingress for gooseek.ru and api.gooseek.ru - Learning cabinet with onboarding, courses, sandbox integration - Medicine service with symptom analysis and doctor matching - Travel service with itinerary planning - Server setup scripts (NVIDIA/CUDA, K3s, Gitea runner) Made-with: Cursor
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package db
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
func TestNewLearningRepository(t *testing.T) {
|
|
pg := &PostgresDB{}
|
|
repo := NewLearningRepository(pg)
|
|
if repo == nil {
|
|
t.Fatalf("expected repository instance")
|
|
}
|
|
if repo.db != pg {
|
|
t.Fatalf("repository must keep provided db pointer")
|
|
}
|
|
}
|
|
|
|
func TestLearningUserProfileJSONContract(t *testing.T) {
|
|
profile := LearningUserProfile{
|
|
UserID: "u-1",
|
|
DisplayName: "Alex",
|
|
Profile: json.RawMessage(`{"target_track":"backend"}`),
|
|
ResumeExtractedText: "resume text",
|
|
OnboardingCompleted: true,
|
|
}
|
|
|
|
raw, err := json.Marshal(profile)
|
|
if err != nil {
|
|
t.Fatalf("marshal profile: %v", err)
|
|
}
|
|
|
|
var decoded map[string]interface{}
|
|
if err := json.Unmarshal(raw, &decoded); err != nil {
|
|
t.Fatalf("unmarshal profile json: %v", err)
|
|
}
|
|
if decoded["userId"] != "u-1" {
|
|
t.Fatalf("unexpected userId: %v", decoded["userId"])
|
|
}
|
|
if decoded["onboardingCompleted"] != true {
|
|
t.Fatalf("unexpected onboardingCompleted: %v", decoded["onboardingCompleted"])
|
|
}
|
|
}
|