| 1 | package daemon |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/FelineStateMachine/tinyrelay/internal/catalog" |
| 7 | ) |
| 8 | |
| 9 | func TestForkRelayURLUsesProcessBase(t *testing.T) { |
| 10 | app := &App{cfg: Config{PublicURL: "https://relay.example" }} |
| 11 | source := &Tenant{meta: structTenant("alice" ), publicURL: "https://relay.example/r/alice" } |
| 12 | if got := app.forkRelayURL(source, "qa" ); got != "https://relay.example/r/qa" { |
| 13 | t.Fatalf("fork URL = %q" , got) |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | func TestForkRelayURLStripsNestedTenantPath(t *testing.T) { |
| 18 | app := &App{} |
| 19 | source := &Tenant{meta: structTenant("alice" ), publicURL: "http://relay.example/r/alice" } |
| 20 | if got := app.forkRelayURL(source, "qa" ); got != "http://relay.example/r/qa" { |
| 21 | t.Fatalf("fork URL = %q" , got) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | func structTenant(name string) catalog.Tenant { return catalog.Tenant{Name: name} } |