package main

import "testing"

func TestSelectComponents(t *testing.T) {
	selected, err := selectComponents("order, wallet")
	if err != nil {
		t.Fatal(err)
	}
	if len(selected) != 2 || selected[0].name != "order" || selected[1].name != "wallet" {
		t.Fatalf("unexpected selection: %#v", selected)
	}
}

func TestSelectComponentsRejectsUnknown(t *testing.T) {
	if _, err := selectComponents("missing"); err == nil {
		t.Fatal("expected unknown component error")
	}
}
