pkg/connector/actions_test.go
42 linesgo
package connector

import (
	"testing"
)

func TestAttrsLookupCompleteness(t *testing.T) {
	expectedKeys := []string{"first_name", "last_name", "email", "department"}

	for _, key := range expectedKeys {
		if _, ok := attrsLookup[key]; !ok {
			t.Errorf("attrsLookup missing expected key: %s", key)
		}
	}

	if len(attrsLookup) != len(expectedKeys) {
		t.Errorf("attrsLookup has %d entries, expected %d", len(attrsLookup), len(expectedKeys))
	}
}

func TestMapUserStatusInactive(t *testing.T) {
	tests := []struct {
		input  string
		expect string
	}{
		{"active", "STATUS_ENABLED"},
		{"inactive", "STATUS_DISABLED"},
		{"disabled", "STATUS_DISABLED"},
		{"deleted", "STATUS_DELETED"},
		{"unknown", "STATUS_UNSPECIFIED"},
	}

	for _, tt := range tests {
		t.Run(tt.input, func(t *testing.T) {
			got := mapUserStatus(tt.input).String()
			if got != tt.expect {
				t.Errorf("mapUserStatus(%q) = %q, want %q", tt.input, got, tt.expect)
			}
		})
	}
}