package adminauth

import "testing"

func TestRolesRequireInitialPasswordChange(t *testing.T) {
	tests := []struct {
		name  string
		roles []RoleDTO
		want  bool
	}{
		{
			name:  "超级管理员需要修改初始密码",
			roles: []RoleDTO{{Code: "super_admin", Name: "超级管理员"}},
			want:  true,
		},
		{
			name:  "客服不强制修改初始密码",
			roles: []RoleDTO{{Code: "cs", Name: "客服"}},
			want:  false,
		},
		{
			name:  "运营不强制修改初始密码",
			roles: []RoleDTO{{Code: "ops", Name: "运营"}},
			want:  false,
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := rolesRequireInitialPasswordChange(tt.roles); got != tt.want {
				t.Fatalf("rolesRequireInitialPasswordChange() = %v, want %v", got, tt.want)
			}
		})
	}
}
