diff --git a/src/AdminGuesser.test.tsx b/src/AdminGuesser.test.tsx
index 374c4481..10ec3b53 100644
--- a/src/AdminGuesser.test.tsx
+++ b/src/AdminGuesser.test.tsx
@@ -1,7 +1,10 @@
import React from 'react';
+import { AdminUI, AuthContext } from 'react-admin';
+import type { AdminProps, AuthProvider } from 'react-admin';
import ReactTestRenderer from 'react-test-renderer/shallow';
-import { AdminResourcesGuesser } from './AdminGuesser.js';
+import AdminGuesser, { AdminResourcesGuesser } from './AdminGuesser.js';
import ResourceGuesser from './ResourceGuesser.js';
+import schemaAnalyzer from './hydra/schemaAnalyzer.js';
import resources from './__fixtures__/resources.js';
import { API_DATA } from './__fixtures__/parsedData.js';
import type {
@@ -83,4 +86,36 @@ describe('', () => {
expect(renderer.getRenderOutput()).toMatchSnapshot();
});
+
+ test('renders with admin element', () => {
+ const authProvider: AuthProvider = {
+ getPermissions: () => Promise.resolve(['user']),
+ getIdentity: () =>
+ Promise.resolve({
+ id: '/users/2',
+ fullName: 'Test User',
+ avatar: undefined,
+ }),
+ login: () => Promise.resolve(),
+ logout: () => Promise.resolve(),
+ checkAuth: () => Promise.resolve(),
+ checkError: () => Promise.resolve(),
+ };
+
+ const AdminEl = (props: AdminProps) => (
+
+
+
+ );
+
+ renderer.render(
+ ,
+ );
+
+ expect(renderer.getRenderOutput()).not.toBeNull();
+ });
});
diff --git a/src/AdminGuesser.tsx b/src/AdminGuesser.tsx
index 1f3b42bd..f9de4564 100644
--- a/src/AdminGuesser.tsx
+++ b/src/AdminGuesser.tsx
@@ -30,6 +30,7 @@ import useDisplayOverrideCode from './useDisplayOverrideCode.js';
import type { ApiPlatformAdminDataProvider, SchemaAnalyzer } from './types.js';
export interface AdminGuesserProps extends AdminProps {
+ admin?: ComponentType;
dataProvider: ApiPlatformAdminDataProvider;
schemaAnalyzer: SchemaAnalyzer;
includeDeprecated?: boolean;
@@ -214,6 +215,7 @@ AdminGuesser.propTypes = {
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
theme: PropTypes.object,
includeDeprecated: PropTypes.bool,
+ admin: PropTypes.elementType,
};
/* eslint-enable tree-shaking/no-side-effects-in-initialization */