package workbench

import "testing"

func TestSelectedBindings(t *testing.T) {
	allowed := []string{"a", "b", "c"}
	all, err := selectedBindings(nil, allowed, "Skill")
	if err != nil || len(all) != 3 {
		t.Fatalf("empty selection should use all bindings: %#v err=%v", all, err)
	}
	selected, err := selectedBindings([]string{"b", "b"}, allowed, "Skill")
	if err != nil || len(selected) != 1 || selected[0] != "b" {
		t.Fatalf("selection should be deduplicated: %#v err=%v", selected, err)
	}
	if _, err := selectedBindings([]string{"outside"}, allowed, "Skill"); err == nil {
		t.Fatal("unbound selection should be rejected")
	}
}
