feat(core): Implement granularity and date range filtering on insights (#14841)

This commit is contained in:
Guillaume Jacquart
2025-04-25 13:54:24 +02:00
committed by GitHub
parent 5ff073bd7b
commit 28596a633e
8 changed files with 247 additions and 32 deletions

View File

@@ -1,5 +1,7 @@
import { Container } from '@n8n/di';
import { mock } from 'jest-mock-extended';
import type { AuthenticatedRequest } from '@/requests';
import { mockInstance } from '@test/mocking';
import * as testDb from '@test-integration/test-db';
@@ -30,7 +32,10 @@ describe('InsightsController', () => {
insightsByPeriodRepository.getPreviousAndCurrentPeriodTypeAggregates.mockResolvedValue([]);
// ACT
const response = await controller.getInsightsSummary();
const response = await controller.getInsightsSummary(
mock<AuthenticatedRequest>(),
mock<Response>(),
);
// ASSERT
expect(response).toEqual({
@@ -52,7 +57,10 @@ describe('InsightsController', () => {
]);
// ACT
const response = await controller.getInsightsSummary();
const response = await controller.getInsightsSummary(
mock<AuthenticatedRequest>(),
mock<Response>(),
);
// ASSERT
expect(response).toEqual({
@@ -78,7 +86,10 @@ describe('InsightsController', () => {
]);
// ACT
const response = await controller.getInsightsSummary();
const response = await controller.getInsightsSummary(
mock<AuthenticatedRequest>(),
mock<Response>(),
);
// ASSERT
expect(response).toEqual({