{setupComponent()}
@@ -33,12 +28,13 @@ describe('App', () => {
expect(fetchClustersList).toHaveBeenCalledTimes(1);
});
- it('correctly renders PageLoader', () => {
- const wrapper = shallow(setupComponent({ isClusterListFetched: false }));
- expect(wrapper.exists('PageLoader')).toBeTruthy();
-
- wrapper.setProps({ isClusterListFetched: true });
- expect(wrapper.exists('PageLoader')).toBeFalsy();
+ it('shows PageLoader until cluster list is fetched', () => {
+ const component = shallow(setupComponent({ isClusterListFetched: false }));
+ expect(component.exists('.Layout__container PageLoader')).toBeTruthy();
+ expect(component.exists('.Layout__container Switch')).toBeFalsy();
+ component.setProps({ isClusterListFetched: true });
+ expect(component.exists('.Layout__container PageLoader')).toBeFalsy();
+ expect(component.exists('.Layout__container Switch')).toBeTruthy();
});
it('correctly renders alerts', () => {
@@ -57,4 +53,9 @@ describe('App', () => {
expect(wrapper.exists('Alert')).toBeTruthy();
expect(wrapper.find('Alert').length).toEqual(1);
});
+
+ it('matches snapshot', () => {
+ const component = shallow(setupComponent());
+ expect(component).toMatchSnapshot();
+ });
});
diff --git a/kafka-ui-react-app/src/components/__test__/__snapshots__/App.spec.tsx.snap b/kafka-ui-react-app/src/components/__tests__/__snapshots__/App.spec.tsx.snap
similarity index 82%
rename from kafka-ui-react-app/src/components/__test__/__snapshots__/App.spec.tsx.snap
rename to kafka-ui-react-app/src/components/__tests__/__snapshots__/App.spec.tsx.snap
index 4804189832..c6531a057f 100644
--- a/kafka-ui-react-app/src/components/__test__/__snapshots__/App.spec.tsx.snap
+++ b/kafka-ui-react-app/src/components/__tests__/__snapshots__/App.spec.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`App matches snapshot with initial props 1`] = `
+exports[`App matches snapshot 1`] = `
@@ -19,6 +19,15 @@ exports[`App matches snapshot with initial props 1`] = `
Kafka UI
+