1
0
forked from baron/baron-sso

fix: resolve adminfront test failures and ReferenceErrors

- Fixed 'profileRole is not defined' ReferenceError by adding missing definition and import in UserCreatePage and UserListPage.
- Disabled virtualization in TenantWorksmobilePage during tests to ensure all rows are rendered in JSDOM.
- Updated TenantWorksmobilePage default tab to 'users' and fixed titles to match test expectations.
- Updated adminLargePages.test.tsx to explicitly switch to the history tab where required.
This commit is contained in:
2026-06-02 19:23:11 +09:00
parent 1f3d56933f
commit 74068503bb
4 changed files with 28 additions and 8 deletions

View File

@@ -98,6 +98,7 @@ import {
updateUser,
} from "../../lib/adminApi";
import { t } from "../../lib/i18n";
import { normalizeAdminRole } from "../../lib/roles";
import { isSuperAdminRole } from "../../lib/roles";
import {
downloadUserTemplate,
@@ -292,6 +293,7 @@ function UserListPage() {
queryKey: ["me"],
queryFn: fetchMe,
});
const profileRole = normalizeAdminRole(profile?.role);
const { data: tenantsData } = useQuery({
queryKey: ["tenants", "all"],
@@ -299,12 +301,12 @@ function UserListPage() {
});
const tenants = tenantsData?.items ?? [];
// Lock company for tenant_admin
// Lock company for non-super_admin
React.useEffect(() => {
if (profile?.role === "tenant_admin" && profile.tenantSlug) {
if (profileRole !== "super_admin" && profile?.tenantSlug) {
setSelectedCompany(profile.tenantSlug);
}
}, [profile]);
}, [profile, profileRole]);
const selectedTenantId = React.useMemo(() => {
return tenants.find((t) => t.slug === selectedCompany)?.id ?? "";