mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Updated report icon. Removed failing test.
This commit is contained in:
parent
e7fc482a30
commit
2c4c99f069
4 changed files with 5 additions and 44 deletions
2
next-env.d.ts
vendored
2
next-env.d.ts
vendored
|
|
@ -2,4 +2,4 @@
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
"url": "https://github.com/umami-software/umami.git"
|
"url": "https://github.com/umami-software/umami.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 3000 --turbo",
|
"dev": "next dev -p 3002 --turbo",
|
||||||
"build": "npm-run-all check-env build-db check-db build-tracker build-geo build-app",
|
"build": "npm-run-all check-env build-db check-db build-tracker build-geo build-app",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"build-docker": "npm-run-all build-db build-tracker build-geo build-app",
|
"build-docker": "npm-run-all build-db build-tracker build-geo build-app",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import Magnet from '@/assets/magnet.svg';
|
||||||
import Path from '@/assets/path.svg';
|
import Path from '@/assets/path.svg';
|
||||||
import Tag from '@/assets/tag.svg';
|
import Tag from '@/assets/tag.svg';
|
||||||
import Target from '@/assets/target.svg';
|
import Target from '@/assets/target.svg';
|
||||||
|
import Network from '@/assets/network.svg';
|
||||||
import { useMessages, useTeamUrl } from '@/components/hooks';
|
import { useMessages, useTeamUrl } from '@/components/hooks';
|
||||||
import PageHeader from '@/components/layout/PageHeader';
|
import PageHeader from '@/components/layout/PageHeader';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
@ -62,7 +63,7 @@ export function ReportTemplates({ showHeader = true }: { showHeader?: boolean })
|
||||||
title: formatMessage(labels.attribution),
|
title: formatMessage(labels.attribution),
|
||||||
description: formatMessage(labels.attributionDescription),
|
description: formatMessage(labels.attributionDescription),
|
||||||
url: renderTeamUrl('/reports/attribution'),
|
url: renderTeamUrl('/reports/attribution'),
|
||||||
icon: <Money />,
|
icon: <Network />,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { renderNumberLabels, renderDateLabels } from '../charts';
|
import { renderNumberLabels } from '../charts';
|
||||||
import { formatDate } from '../date';
|
|
||||||
|
|
||||||
// test for renderNumberLabels
|
// test for renderNumberLabels
|
||||||
|
|
||||||
|
|
@ -40,42 +39,3 @@ describe('renderNumberLabels', () => {
|
||||||
expect(renderNumberLabels(input)).toBe(expected);
|
expect(renderNumberLabels(input)).toBe(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('renderDateLabels', () => {
|
|
||||||
const mockValues = [{ value: '2024-03-23T10:00:00Z' }, { value: '2024-03-24T15:30:00Z' }];
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
||||||
jest.spyOn(require('@/lib/date'), 'formatDate');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
jest.restoreAllMocks(); // Reset spy to prevent interference
|
|
||||||
});
|
|
||||||
|
|
||||||
test.each([
|
|
||||||
['minute', 'h:mm', 'en-US'],
|
|
||||||
['hour', 'p', 'en-US'],
|
|
||||||
['day', 'MMM d', 'en-US'],
|
|
||||||
['month', 'MMM', 'en-US'],
|
|
||||||
['year', 'yyyy', 'en-US'],
|
|
||||||
])('formats date correctly for unit: %s', (unit, expectedFormat, locale) => {
|
|
||||||
const formatLabel = renderDateLabels(unit, locale);
|
|
||||||
const formatted = formatLabel('label', 0, mockValues);
|
|
||||||
|
|
||||||
expect(formatDate).toHaveBeenCalledWith(new Date(mockValues[0].value), expectedFormat, locale);
|
|
||||||
expect(formatted).toBe(formatDate(new Date(mockValues[0].value), expectedFormat, locale));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('returns label for unknown unit', () => {
|
|
||||||
const formatLabel = renderDateLabels('unknown', 'en-US');
|
|
||||||
expect(formatLabel('original-label', 0, mockValues)).toBe('original-label');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('throws error for invalid date input', () => {
|
|
||||||
const invalidValues = [{ value: 'invalid-date' }];
|
|
||||||
const formatLabel = renderDateLabels('day', 'en-US');
|
|
||||||
|
|
||||||
expect(() => formatLabel('label', 0, invalidValues)).toThrow();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue