package bootstrapimpl

import "testing"

// TestSystemTableUserRoleHasKeyPrefix guards against a regression where UserRole lacks a
// keyPrefix declaration in system_tables.json. Without this prefix the record-trigger
// listener errors on any UUID-format record ID with "no metadata key prefix for object
// UserRole", blocking all REST-driven UserRole creation (issue #426).
func TestSystemTableUserRoleHasKeyPrefix(t *testing.T) {
	defs := GetSystemTableDefinitions()
	for _, def := range defs {
		if def.TableName == "UserRole" {
			if def.KeyPrefix == "" {
				t.Fatal("UserRole must have a non-empty keyPrefix in system_tables.json (required for record-trigger dispatch on UUID record IDs)")
			}
			return
		}
	}
	t.Fatal("UserRole not found in system_tables.json")
}
