package main

import "testing"

func TestNormalizeWorkspace(t *testing.T) {
	tests := []struct {
		input string
		want  string
		ok    bool
	}{
		{input: "default", want: "default", ok: true},
		{input: " Tenant_01 ", want: "tenant_01", ok: true},
		{input: "../prod", ok: false},
		{input: "", ok: false},
		{input: "tenant.name", ok: false},
	}
	for _, test := range tests {
		got, err := normalizeWorkspace(test.input)
		if (err == nil) != test.ok {
			t.Fatalf("normalizeWorkspace(%q) error = %v", test.input, err)
		}
		if got != test.want {
			t.Fatalf("normalizeWorkspace(%q) = %q, want %q", test.input, got, test.want)
		}
	}
}
