Skip to content

Commit

Permalink
support for search filter in service details page (AthenZ#1473)
Browse files Browse the repository at this point in the history
* support for  search filter in service details page

Signed-off-by: jothi avanachandu <[email protected]>

* adding test for dynamic

Signed-off-by: jothi avanachandu <[email protected]>

* update snapshot

Signed-off-by: jothi avanachandu <[email protected]>

Co-authored-by: jothi avanachandu <[email protected]>
  • Loading branch information
jothi-prasad and jothi avanachandu authored May 11, 2021
1 parent 3d33065 commit ba5cee1
Show file tree
Hide file tree
Showing 3 changed files with 598 additions and 28 deletions.
54 changes: 52 additions & 2 deletions ui/src/__tests__/components/service/InstanceList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/
import React from 'react';
import { render } from '@testing-library/react';
import { render, fireEvent, screen } from '@testing-library/react';
import InstanceList from "../../../components/service/InstanceList";
import API from "../../../api";

describe('InstanceList', () => {
it('should render', () => {
it('should render for static', () => {
let api = API();
let domain = 'athenz';
let _csrf = '_csrfToken';
Expand All @@ -39,4 +39,54 @@ describe('InstanceList', () => {

expect(instanceList).toMatchSnapshot();
});

it('should render for dynamic', () => {
let api = API();
let domain = 'athenz';
let _csrf = '_csrfToken';
let instanceDetails = [
{
"domainName": null,
"serviceName": null,
"uuid": "zms3",
"ipAddresses": ['74.6.35.54'],
"hostname": "NA",
"provider": "sys.openstack.openstack-classic",
"updateTime": "2021-04-09T19:32:17.000Z",
"certExpiryTime": "1970-01-01T00:00:00.000z"
}
];
let service = 'testService';

const { getByTestId } = render(
<InstanceList
category={'dynamic'}
api={api}
domain={domain}
_csrf={_csrf}
instances={instanceDetails}
service={service}
/>);
const instanceList = getByTestId('instancelist');

expect(
screen.getByPlaceholderText('Search')
).toBeInTheDocument();
fireEvent.change(
screen.getByPlaceholderText("Select an option"),
{
target: { value: "Instance"},
}
);

fireEvent.change(
screen.getByPlaceholderText('Search'),
{
target: { value: '74.6.35.54' },
}
);

expect(instanceList).toMatchSnapshot();
});

});
Loading

0 comments on commit ba5cee1

Please sign in to comment.