package app

import (
    "os"
    "path/filepath"
    "strings"
    "testing"
    "time"

    cfgpkg "github.com/jan/fm-rds-tx/internal/config"
)

func TestRunSimulatedTransmit(t *testing.T) {
    cfg := cfgpkg.Default()
    out := filepath.Join(t.TempDir(), "simulated.iqf32")
    summary, err := RunSimulatedTransmit(cfg, out, 20*time.Millisecond)
    if err != nil {
        t.Fatalf("RunSimulatedTransmit failed: %v", err)
    }
    if !strings.Contains(summary, "simulated transmit") {
        t.Fatalf("unexpected summary: %s", summary)
    }
    if !strings.Contains(summary, "freq=") {
        t.Fatalf("summary missing frequency: %s", summary)
    }
    if info, err := os.Stat(out); err != nil || info.Size() == 0 {
        t.Fatalf("expected non-empty output file, err=%v", err)
    }
}
