Added more tests covering how real-time visits are filtered out based on date intervals

This commit is contained in:
Alejandro Celaya
2021-10-24 22:37:14 +02:00
parent e135dd92ec
commit 6d392ba403
6 changed files with 151 additions and 19 deletions

View File

@@ -25,10 +25,6 @@ export const parseDate = (date: string, format: string) => parse(date, format, n
const parseISO = (date: DateOrString): Date => isDateObject(date) ? date : stdParseISO(date);
export const isBetween = (date: DateOrString, start?: DateOrString, end?: DateOrString): boolean => {
if (!start && !end) {
return true;
}
if (!start && end) {
return isBefore(parseISO(date), parseISO(end));
}
@@ -41,5 +37,5 @@ export const isBetween = (date: DateOrString, start?: DateOrString, end?: DateOr
return isWithinInterval(parseISO(date), { start: parseISO(start), end: parseISO(end) });
}
return false;
return true;
};

View File

@@ -5,9 +5,9 @@ import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilde
import { GetState } from '../../container/types';
import { ShlinkVisitsParams } from '../../api/types';
import { ApiErrorAction } from '../../api/types/actions';
import { isBetween } from '../../utils/helpers/date';
import { getVisitsWithLoader } from './common';
import { CREATE_VISITS, CreateVisitsAction } from './visitCreation';
import { isBetween } from '../../utils/helpers/date';
/* eslint-disable padding-line-between-statements */
export const GET_TAG_VISITS_START = 'shlink/tagVisits/GET_TAG_VISITS_START';