package cli

import (
	"bytes"
	"strings"
	"testing"
)

func TestLabList_ShowsAllTargets(t *testing.T) {
	var buf bytes.Buffer
	labListCmd.SetOut(&buf)
	if err := labListCmd.RunE(labListCmd, nil); err != nil {
		t.Fatal(err)
	}
	out := buf.String()
	for _, name := range []string{"juiceshop", "crapi", "vampi", "dvga", "dvwa", "webgoat", "bwapp", "mutillidae"} {
		if !strings.Contains(out, name) {
			t.Errorf("lab list output missing %q", name)
		}
	}
	if !strings.Contains(out, "--lab-target") {
		t.Error("lab list should show the run hint")
	}
}
