diff --git a/kafka-ui-react-app/src/components/Dashboard/ClustersWidget/__test__/ClusterWidget.spec.tsx b/kafka-ui-react-app/src/components/Dashboard/ClustersWidget/__test__/ClusterWidget.spec.tsx
index e8d21e6ab3..4cc652e05c 100644
--- a/kafka-ui-react-app/src/components/Dashboard/ClustersWidget/__test__/ClusterWidget.spec.tsx
+++ b/kafka-ui-react-app/src/components/Dashboard/ClustersWidget/__test__/ClusterWidget.spec.tsx
@@ -70,4 +70,17 @@ describe('ClusterWidget', () => {
).toMatchSnapshot();
});
});
+
+ describe('when cluster is read-only', () => {
+ it('renders the tag', () => {
+ expect(
+ shallow(
+
+ )
+ .find('.title')
+ .childAt(1)
+ .text()
+ ).toEqual('readonly');
+ });
+ });
});
diff --git a/kafka-ui-react-app/src/components/Schemas/Details/__test__/Details.spec.tsx b/kafka-ui-react-app/src/components/Schemas/Details/__test__/Details.spec.tsx
index 816f20380c..3b64a3d12f 100644
--- a/kafka-ui-react-app/src/components/Schemas/Details/__test__/Details.spec.tsx
+++ b/kafka-ui-react-app/src/components/Schemas/Details/__test__/Details.spec.tsx
@@ -101,6 +101,12 @@ describe('Details', () => {
expect(shallow(setupWrapper({ versions }))).toMatchSnapshot();
});
});
+
+ describe('when the readonly flag is set', () => {
+ it('mathces the snapshot', () => {
+ expect(shallow(setupWrapper({ isReadOnly: true }))).toMatchSnapshot();
+ });
+ });
});
});
});
diff --git a/kafka-ui-react-app/src/components/Schemas/Details/__test__/__snapshots__/Details.spec.tsx.snap b/kafka-ui-react-app/src/components/Schemas/Details/__test__/__snapshots__/Details.spec.tsx.snap
index 7871bb5588..e4268c2abf 100644
--- a/kafka-ui-react-app/src/components/Schemas/Details/__test__/__snapshots__/Details.spec.tsx.snap
+++ b/kafka-ui-react-app/src/components/Schemas/Details/__test__/__snapshots__/Details.spec.tsx.snap
@@ -322,6 +322,92 @@ exports[`Details View when page with schema versions loaded when schema has vers
`;
+exports[`Details View when page with schema versions loaded when the readonly flag is set mathces the snapshot 1`] = `
+
+
+
+ test
+
+
+
+
+
+
+
+
+ Latest Version
+
+
+
+ #
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ Version
+ |
+
+ ID
+ |
+
+ Schema
+ |
+
+
+
+
+
+
+`;
+
exports[`Details View when page with schema versions loaded when versions are empty matches snapshot 1`] = `
{
expect(wrapper.find('ListItem').length).toEqual(3);
});
});
+
+ describe('with readonly cluster', () => {
+ const wrapper = shallow(setupWrapper({ schemas, isReadOnly: true }));
+ it('does not render Create Schema button', () => {
+ expect(wrapper.exists('NavLink')).toBeFalsy();
+ });
+ });
});
});
diff --git a/kafka-ui-react-app/src/components/Topics/List/__tests__/List.spec.tsx b/kafka-ui-react-app/src/components/Topics/List/__tests__/List.spec.tsx
new file mode 100644
index 0000000000..16202b1a86
--- /dev/null
+++ b/kafka-ui-react-app/src/components/Topics/List/__tests__/List.spec.tsx
@@ -0,0 +1,18 @@
+import { shallow } from 'enzyme';
+import React from 'react';
+import List from '../List';
+
+describe('List', () => {
+ describe('when it has readonly flag', () => {
+ it('does not render the Add a Topic button', () => {
+ const props = {
+ clusterName: 'Cluster',
+ topics: [],
+ externalTopics: [],
+ isReadOnly: true,
+ };
+ const component = shallow(
);
+ expect(component.exists('NavLink')).toBeFalsy();
+ });
+ });
+});