Add reporting features with new report engine and bookmark management
- Introduced a comprehensive report engine for generating and managing reports, including sales and logistics reports. - Added new API endpoints for retrieving report configurations, data, and metadata, ensuring secure access with privilege checks. - Implemented a report bookmarks system to allow users to save and manage report filters and configurations. - Created database migrations for the `report_bookmarks` table and updated the schema to support new report functionalities. - Developed services and controllers for handling report queries and bookmarks, including CRUD operations for bookmarks. - Enhanced API documentation to reflect the new reporting features and endpoints. - Added unit and integration tests to validate the new functionalities and ensure data integrity across report operations.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { DATA_FORMAT } from '../constants/data-format';
|
||||
import { formatReportCell, formatReportRow } from './report-cell.formatter';
|
||||
|
||||
describe('report cell formatter', () => {
|
||||
it('formats currency null as zero', () => {
|
||||
expect(formatReportCell(null, DATA_FORMAT.CURRENCY)).toBe('0.0000');
|
||||
});
|
||||
|
||||
it('formats boolean yes/no', () => {
|
||||
expect(formatReportCell(true, DATA_FORMAT.BOOLEAN)).toBe('Yes');
|
||||
expect(formatReportCell(0, DATA_FORMAT.BOOLEAN)).toBe('No');
|
||||
});
|
||||
|
||||
it('formats uppercase text', () => {
|
||||
expect(formatReportCell('draft', DATA_FORMAT.TEXT_UPPERCASE)).toBe('DRAFT');
|
||||
});
|
||||
|
||||
it('formats row by column config', () => {
|
||||
const row = formatReportRow(
|
||||
{ main__status: 'active', main__amount: '10.5' },
|
||||
[
|
||||
{
|
||||
column: 'main__status',
|
||||
query: 'main.status',
|
||||
label: 'Status',
|
||||
type: 'dimension',
|
||||
format: DATA_FORMAT.TEXT_UPPERCASE,
|
||||
},
|
||||
{
|
||||
column: 'main__amount',
|
||||
query: 'main.amount',
|
||||
label: 'Amount',
|
||||
type: 'measure',
|
||||
format: DATA_FORMAT.CURRENCY,
|
||||
},
|
||||
],
|
||||
);
|
||||
expect(row.main__status).toBe('ACTIVE');
|
||||
expect(row.main__amount).toBe('10.5000');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user