Do not watch tests & fix time formatting

This commit is contained in:
2026-04-25 19:12:35 +02:00
parent 192432f8e5
commit 2136c10f69
3 changed files with 17 additions and 2 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"test": "vitest",
"test": "vitest run",
"test:all": "vitest run && npx playwright test",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
},
+15
View File
@@ -110,3 +110,18 @@ export function timeToMinutes(timeStr: string): number {
const [hours, minutes] = timeStr.split(":").map(Number);
return hours * 60 + minutes;
}
/**
* Convert total minutes to a human-readable string (e.g., "1h 30m" or "45m")
* @param totalMinutes - Total number of minutes
* @returns Formatted string
*/
export function formatMinutes(totalMinutes: number): string {
const hours = Math.floor(totalMinutes / 60);
const mins = totalMinutes % 60;
if (hours > 0) {
return `${hours}h ${mins}m`;
}
return `${mins}m`;
}
+1 -1
View File
@@ -82,7 +82,7 @@ describe('formatMinutes', () => {
});
it('formats hours only', () => {
expect(formatMinutes(120)).toBe('2h');
expect(formatMinutes(120)).toBe('2h 0m');
});
it('formats minutes only', () => {