Skip to content
Snippets Groups Projects
Commit af015591 authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Increase test coverage of alerts reducer

parent 20645047
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,8 @@ import {AlertTypes, AlertLevels} from '../../../src/lib/alerts/index.jsx';
import alertsReducer from '../../../src/reducers/alerts';
import {
closeAlert,
filterInlineAlerts,
filterPopupAlerts,
showStandardAlert
} from '../../../src/reducers/alerts';
......@@ -123,3 +125,54 @@ test('several related alerts can be cleared at once', () => {
expect(resultState.alertsList.length).toBe(1);
expect(resultState.alertsList[0].alertId).toBe('createSuccess');
});
test('filterInlineAlerts only returns inline type alerts', () => {
const alerts = [
{
alertId: 'extension',
alertType: AlertTypes.EXTENSION
},
{
alertId: 'inline',
alertType: AlertTypes.INLINE
},
{
alertId: 'standard',
alertType: AlertTypes.STANDARD
},
{
alertId: 'non-existent type',
alertType: 'wirly-burly'
}
];
const filtered = filterInlineAlerts(alerts);
expect(filtered.length).toEqual(1);
expect(filtered[0].alertId).toEqual('inline');
});
test('filterPopupAlerts returns standard and extension type alerts', () => {
const alerts = [
{
alertId: 'extension',
alertType: AlertTypes.EXTENSION
},
{
alertId: 'inline',
alertType: AlertTypes.INLINE
},
{
alertId: 'standard',
alertType: AlertTypes.STANDARD
},
{
alertId: 'non-existent type',
alertType: 'wirly-burly'
}
];
const filtered = filterPopupAlerts(alerts);
expect(filtered.length).toEqual(2);
expect(filtered[0].alertId).toEqual('extension');
expect(filtered[1].alertId).toEqual('standard');
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment