GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit db61bf61 authored by Marjolaine Bodin's avatar Marjolaine Bodin

#487 add tests

parent 2c039d84
Pipeline #46565 passed with stage
in 3 minutes and 4 seconds
......@@ -79,7 +79,7 @@ export function buildEventFilter(filterTypeCategory) {
return filter;
}
function buildSingleEventFilter(singleFilter) {
export function buildSingleEventFilter(singleFilter) {
if (singleFilter.type === ANNOTATION && !singleFilter.category) {
return buildEventFilterForUserComment();
}
......
......@@ -66,7 +66,7 @@ describe('selectionFilterHelper', () => {
});
});
/* describe('buildSingleEventFilter', () => {
describe('buildSingleEventFilter', () => {
describe('handle errors', () => {
it.each(
resources.buildSingleEventFilter,
......@@ -75,12 +75,14 @@ describe('selectionFilterHelper', () => {
(element, next) => {
const buildSingleEventFilter = require('../../containers/Logbook/SelectionFilterHelper')
.buildSingleEventFilter;
expect(buildSingleEventFilter(element.filter)).toEqual(element.expected);
expect(buildSingleEventFilter(element.filter)).toEqual(
element.expected
);
next();
}
);
});
});*/
});
describe('buildEventFilter', () => {
describe('handle errors', () => {
......
......@@ -5,6 +5,7 @@ import {
EVENT_CATEGORY_ERROR,
ANNOTATION,
NOTIFICATION,
EVENT_CATEGORY_INFO,
} from '../../../constants/eventTypes';
const ANNOTATION_FILTER = {
......@@ -527,6 +528,39 @@ module.exports = {
},
],
buildSingleEventFilter: [
{
description:
'returns the single event filter for annotation without category',
filter: { type: ANNOTATION },
expected: ANNOTATION_FILTER,
},
{
description:
'returns the single event filter for annotation with category',
filter: { type: ANNOTATION, category: EVENT_CATEGORY_COMMENT },
expected: {
$and: [{ type: 'annotation' }, { category: 'comment' }],
},
},
{
description:
'returns the single event filter for notification with category',
filter: { type: NOTIFICATION, category: EVENT_CATEGORY_INFO },
expected: {
$and: [{ type: 'notification' }, { category: 'info' }],
},
},
{
description:
'returns the single event filter for notification without category',
filter: { type: NOTIFICATION },
expected: {
$and: [{ type: 'notification' }],
},
},
],
buildEventFilter: [
{
description: 'returns the event filter for only users comment',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment