Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error message in conf managment and add test #3443

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ All notable changes to the Wazuh app project will be documented in this file.
### Fixed

- Fixed creation of log files [#3384](https://github.com/wazuh/wazuh-kibana-app/pull/3384)
- Fix error message in conf managment [#3443](https://github.com/wazuh/wazuh-kibana-app/pull/3443)

## Wazuh v4.2.1 - Kibana 7.10.2 , 7.11.2 - Revision 4202

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`WzConfigurationAlerts component mount OK renders correctly to match the snapshot 1`] = `
<ContextProvider
value={
Object {
"store": Object {
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],
},
"subscription": Subscription {
"handleChangeWrapper": [Function],
"listeners": Object {
"notify": [Function],
},
"onStateChange": [Function],
"parentSub": undefined,
"store": Object {
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],
},
"unsubscribe": null,
},
}
}
>
<Connect(WithLoading(Connect(WzConfigurationAlerts)))
agent={
Object {
"id": "000",
}
}
clusterNodeSelected="master-node"
currentConfig={
Object {
"analysis-alerts": Object {
"alerts": Object {
"email_alert_level": 12,
"log_alert_level": 3,
},
},
"analysis-labels": Object {
"labels": Array [],
},
"csyslog-csyslog": "Fetch configuration. 3013 - Error connecting with socket",
"mail-alerts": "Fetch configuration. 3013 - Error connecting with socket",
"monitor-reports": Object {},
}
}
refreshTime={false}
wazuhNotReadyYet=""
/>
</ContextProvider>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import WzConfigurationAlerts from './alerts';
import { shallow } from 'enzyme';
import { Provider } from 'react-redux';
import configureMockStore from 'redux-mock-store';

jest.mock('../../../../../../kibana-services', () => ({
getUiSettings:() => ({
get:() => {
return false
}
}),
}));

const mockProps = {
"clusterNodeSelected":"master-node",
"agent":{
"id":"000"
},
"refreshTime":false,
"currentConfig":{
"analysis-alerts":{
"alerts":{
"email_alert_level":12,
"log_alert_level":3
}
},
"analysis-labels":{
"labels":[

]
},
"mail-alerts":"Fetch configuration. 3013 - Error connecting with socket",
"monitor-reports":{

},
"csyslog-csyslog":"Fetch configuration. 3013 - Error connecting with socket"
},
"wazuhNotReadyYet":""
}


const mockStore = configureMockStore();
const store = mockStore({});

describe('WzConfigurationAlerts component mount OK', () => {

it('renders correctly to match the snapshot', () => {
const wrapper = shallow(
<Provider store={store}>
<WzConfigurationAlerts {...mockProps} />
</Provider>
);
expect(wrapper).toMatchSnapshot();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ class WzNoConfig extends Component {
<EuiFlexItem>
<div style={{ textAlign: 'center' }}>
<EuiIcon type="help" style={{ marginRight: '4px' }} />
{(error === 'not-present' && (
<span>Configuration not available</span>
)) || <span>Error fetching configuration</span>}
{help && <WzHelpButtonPopover links={help} />}
<EuiHorizontalRule margin="s" />
{(error === 'not-present' && (
<p>This section is not present on the configuration file.</p>
)) || (
<span>
There was a problem while fetching the configuration for this
section.
section. It may be a server problem or the configuration doesn't exist.
</span>
)}
<EuiSpacer size="s" />
Expand Down