package store import "testing" func TestOIDCProjectionKindRequiresExplicitCompatibleContext(t *testing.T) { applicationID := "11111111-1111-4111-8111-111111111111" tests := []struct { name string input ResolveOrProvisionOIDCUserInput want string }{ { name: "platform in multi-tenant application", input: ResolveOrProvisionOIDCUserInput{ ContextType: "platform", TenantMode: "multi_tenant", ApplicationID: applicationID, }, want: "platform", }, { name: "tenant in multi-tenant application", input: ResolveOrProvisionOIDCUserInput{ ContextType: "tenant", TenantMode: "multi_tenant", ApplicationID: applicationID, TenantID: "22222222-2222-4222-8222-222222222222", }, want: "multi_tenant", }, { name: "tenant in single-tenant application", input: ResolveOrProvisionOIDCUserInput{ ContextType: "tenant", TenantMode: "single_tenant", TenantID: "tenant-contract-id", }, want: "single_tenant", }, { name: "missing context", input: ResolveOrProvisionOIDCUserInput{ TenantMode: "multi_tenant", ApplicationID: applicationID, TenantID: "22222222-2222-4222-8222-222222222222", }, }, { name: "platform context with tenant", input: ResolveOrProvisionOIDCUserInput{ ContextType: "platform", TenantMode: "multi_tenant", ApplicationID: applicationID, TenantID: "22222222-2222-4222-8222-222222222222", }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { if got := oidcProjectionKind(test.input); got != test.want { t.Fatalf("projection kind=%q, want %q", got, test.want) } }) } }