-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix error message in conf managment and add test (#3443)
- Loading branch information
1 parent
593cf89
commit 0e27c63
Showing
3 changed files
with
120 additions
and
3 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
...ponents/management/configuration/alerts/__snapshots__/alerts-configurations.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |
57 changes: 57 additions & 0 deletions
57
...lers/management/components/management/configuration/alerts/alerts-configurations.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters