Fork channel

Create a new channel as a copy of main.

Rename channel

Rename main to:

Delete channel

Delete main? This cannot be undone.

calls_test.go
package cmd

import (
	"strings"
	"testing"
)

func TestRunCalls_NoArgs(t *testing.T) {
	err := RunCalls([]string{})
	if err == nil {
		t.Error("expected error for no args")
	}
	if !strings.Contains(err.Error(), "subcommand required") {
		t.Errorf("unexpected error: %v", err)
	}
}

func TestRunCalls_UnknownSubcommand(t *testing.T) {
	err := RunCalls([]string{"nonexistent"})
	if err == nil {
		t.Error("expected error for unknown subcommand")
	}
	if !strings.Contains(err.Error(), "unknown") {
		t.Errorf("unexpected error: %v", err)
	}
}

func TestCallsSubcommandsComplete(t *testing.T) {
	// Ensure the map has all expected subcommands
	expected := []string{
		"from-preds", "from-birda", "from-raven", "show-images",
		"classify", "clip", "add", "remove", "modify", "push-certainty",
		"detect-anomalies", "propagate", "summarise", "clip-labels",
	}
	for _, name := range expected {
		if _, ok := callsSubcommands[name]; !ok {
			t.Errorf("callsSubcommands missing: %s", name)
		}
	}
	if len(callsSubcommands) != len(expected) {
		t.Errorf("callsSubcommands has %d entries, expected %d", len(callsSubcommands), len(expected))
	}
}