Null-DRM-Official/apps/streamd/internal/api/apps_test.go
404errordeveloper 8fc7e4c0b8 streamd: serve start/stop/update, streamd.yaml, egress, module panel fixes
- Add streamd serve start|stop|restart|status|update with auto-written streamd.yaml
- Panel modules: STREAMD_MODULES_DIR for describe, YAML channel fallback, textarea value fix
- Per-stream WireGuard/SOCKS egress profiles + Settings UI
- Drop drm-* from release builds; track streamd-bg.sh / streamd-update.sh wrappers
- Docs: streamd-server-setup lifecycle and update flow
2026-10-10 18:05:51 +02:00

45 lines
1 KiB
Go

package api
import (
"os"
"path/filepath"
"testing"
"streamd/apps/streamd/internal/modstore"
)
func TestChannelsFromStoreYAML(t *testing.T) {
root := t.TempDir()
store := modstore.New(root)
modDir := filepath.Join(root, "rte")
if err := os.MkdirAll(modDir, 0o755); err != nil {
t.Fatal(err)
}
yaml := []byte(`package: air.RTE
channels:
rteone:
label: RTE One
rtetwo:
label: RTE 2
`)
if err := os.WriteFile(filepath.Join(modDir, "module.yaml"), yaml, 0o644); err != nil {
t.Fatal(err)
}
chans := channelsFromStoreYAML(store, "rte")
if len(chans) != 2 {
t.Fatalf("got %d channels: %+v", len(chans), chans)
}
if chans[0].ID != "rteone" || chans[0].Label != "RTE One" {
t.Fatalf("first channel: %+v", chans[0])
}
if chans[1].ID != "rtetwo" {
t.Fatalf("second channel: %+v", chans[1])
}
}
func TestChannelsFromStoreYAMLMissing(t *testing.T) {
store := modstore.New(t.TempDir())
if chans := channelsFromStoreYAML(store, "nope"); chans != nil {
t.Fatalf("expected nil, got %+v", chans)
}
}