Test new functionality
This commit is contained in:
parent
93d471f408
commit
b9f6390b10
5 changed files with 130 additions and 0 deletions
|
@ -70,4 +70,17 @@ describe('ClusterWidget', () => {
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('when cluster is read-only', () => {
|
||||||
|
it('renders the tag', () => {
|
||||||
|
expect(
|
||||||
|
shallow(
|
||||||
|
<ClusterWidget cluster={{ ...onlineCluster, readOnly: true }} />
|
||||||
|
)
|
||||||
|
.find('.title')
|
||||||
|
.childAt(1)
|
||||||
|
.text()
|
||||||
|
).toEqual('readonly');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -101,6 +101,12 @@ describe('Details', () => {
|
||||||
expect(shallow(setupWrapper({ versions }))).toMatchSnapshot();
|
expect(shallow(setupWrapper({ versions }))).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('when the readonly flag is set', () => {
|
||||||
|
it('mathces the snapshot', () => {
|
||||||
|
expect(shallow(setupWrapper({ isReadOnly: true }))).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -322,6 +322,92 @@ exports[`Details View when page with schema versions loaded when schema has vers
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`Details View when page with schema versions loaded when the readonly flag is set mathces the snapshot 1`] = `
|
||||||
|
<div
|
||||||
|
className="section"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="level"
|
||||||
|
>
|
||||||
|
<Breadcrumb
|
||||||
|
links={
|
||||||
|
Array [
|
||||||
|
Object {
|
||||||
|
"href": "/ui/clusters/Test cluster/schemas",
|
||||||
|
"label": "Schema Registry",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
|
test
|
||||||
|
</Breadcrumb>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="box"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="level"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="level-left"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="level-item"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="mr-1"
|
||||||
|
>
|
||||||
|
<b>
|
||||||
|
Latest Version
|
||||||
|
</b>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="tag is-info is-light"
|
||||||
|
title="Version"
|
||||||
|
>
|
||||||
|
#
|
||||||
|
1
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<LatestVersionItem
|
||||||
|
schema={
|
||||||
|
Object {
|
||||||
|
"compatibilityLevel": "BACKWARD",
|
||||||
|
"id": 1,
|
||||||
|
"schema": "{\\"type\\":\\"record\\",\\"name\\":\\"MyRecord1\\",\\"namespace\\":\\"com.mycompany\\",\\"fields\\":[{\\"name\\":\\"id\\",\\"type\\":\\"long\\"}]}",
|
||||||
|
"subject": "test",
|
||||||
|
"version": "1",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="box"
|
||||||
|
>
|
||||||
|
<table
|
||||||
|
className="table is-striped is-fullwidth"
|
||||||
|
>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Version
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
ID
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Schema
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody />
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`Details View when page with schema versions loaded when versions are empty matches snapshot 1`] = `
|
exports[`Details View when page with schema versions loaded when versions are empty matches snapshot 1`] = `
|
||||||
<div
|
<div
|
||||||
className="section"
|
className="section"
|
||||||
|
|
|
@ -49,5 +49,12 @@ describe('List', () => {
|
||||||
expect(wrapper.find('ListItem').length).toEqual(3);
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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(<List {...props} />);
|
||||||
|
expect(component.exists('NavLink')).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue