Implement testing framework with Vitest, add unit tests for API routes and utility functions, and configure CI workflow for automated testing. Update package dependencies for testing libraries and add test scripts to package.json.
Some checks are pending
CI / test (push) Waiting to run
Some checks are pending
CI / test (push) Waiting to run
This commit is contained in:
@@ -1,33 +1,13 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { downloadVideo } from '@/lib/youtube';
|
||||
import { isValidYouTubeUrl } from '@/lib/utils';
|
||||
import type { DownloadRequest, AudioFormat, VideoFormat, FormatType } from '@/lib/types';
|
||||
import { getMimeType } from '@/lib/mime';
|
||||
import type { DownloadRequest } from '@/lib/types';
|
||||
import { createReadStream } from 'fs';
|
||||
import { stat } from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
const VIDEO_MIME: Record<VideoFormat, string> = {
|
||||
mp4: 'video/mp4',
|
||||
webm: 'video/webm',
|
||||
mkv: 'video/x-matroska',
|
||||
avi: 'video/x-msvideo',
|
||||
};
|
||||
|
||||
const AUDIO_MIME: Record<AudioFormat, string> = {
|
||||
mp3: 'audio/mpeg',
|
||||
wav: 'audio/wav',
|
||||
m4a: 'audio/mp4',
|
||||
opus: 'audio/ogg',
|
||||
};
|
||||
|
||||
function getMimeType(formatType: FormatType, format: VideoFormat | AudioFormat): string {
|
||||
if (formatType === 'video') {
|
||||
return VIDEO_MIME[format as VideoFormat] || 'application/octet-stream';
|
||||
}
|
||||
return AUDIO_MIME[format as AudioFormat] || 'application/octet-stream';
|
||||
}
|
||||
|
||||
async function resolveDownloadPath(downloadUrl: string) {
|
||||
const sanitized = downloadUrl.startsWith('/') ? downloadUrl.slice(1) : downloadUrl;
|
||||
const filePath = path.join(process.cwd(), 'public', sanitized);
|
||||
|
||||
149
app/api/download/route.test.ts
Normal file
149
app/api/download/route.test.ts
Normal file
@@ -0,0 +1,149 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { POST } from './route'
|
||||
import { NextRequest } from 'next/server'
|
||||
|
||||
vi.mock('@/lib/youtube', () => ({
|
||||
downloadVideo: vi.fn(),
|
||||
}))
|
||||
|
||||
import { downloadVideo } from '@/lib/youtube'
|
||||
|
||||
const mockDownloadVideo = vi.mocked(downloadVideo)
|
||||
|
||||
function createRequest(body: object): NextRequest {
|
||||
return new NextRequest('http://localhost:3000/api/download', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
|
||||
describe('POST /api/download', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('returns 400 when url is missing', async () => {
|
||||
const request = createRequest({ format: 'mp4', formatType: 'video' })
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(400)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Missing required fields')
|
||||
})
|
||||
|
||||
it('returns 400 when format is missing', async () => {
|
||||
const request = createRequest({ url: 'https://youtube.com/watch?v=abc', formatType: 'video' })
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(400)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Missing required fields')
|
||||
})
|
||||
|
||||
it('returns 400 when formatType is missing', async () => {
|
||||
const request = createRequest({ url: 'https://youtube.com/watch?v=abc', format: 'mp4' })
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(400)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Missing required fields')
|
||||
})
|
||||
|
||||
it('returns 400 for invalid YouTube URL', async () => {
|
||||
const request = createRequest({
|
||||
url: 'https://vimeo.com/123',
|
||||
format: 'mp4',
|
||||
formatType: 'video',
|
||||
})
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(400)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Invalid YouTube URL')
|
||||
})
|
||||
|
||||
it('returns 500 when download fails', async () => {
|
||||
mockDownloadVideo.mockResolvedValue({
|
||||
success: false,
|
||||
error: 'Download failed',
|
||||
})
|
||||
|
||||
const request = createRequest({
|
||||
url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
||||
format: 'mp4',
|
||||
formatType: 'video',
|
||||
})
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(500)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Download failed')
|
||||
})
|
||||
|
||||
it('returns download result on success', async () => {
|
||||
const mockResult = {
|
||||
success: true,
|
||||
downloadUrl: '/downloads/123.mp4',
|
||||
filename: 'video.mp4',
|
||||
}
|
||||
mockDownloadVideo.mockResolvedValue(mockResult)
|
||||
|
||||
const request = createRequest({
|
||||
url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
||||
format: 'mp4',
|
||||
formatType: 'video',
|
||||
})
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(200)
|
||||
expect(data.success).toBe(true)
|
||||
expect(data.downloadUrl).toBe('/downloads/123.mp4')
|
||||
expect(data.filename).toBe('video.mp4')
|
||||
})
|
||||
|
||||
it('passes correct parameters to downloadVideo', async () => {
|
||||
mockDownloadVideo.mockResolvedValue({
|
||||
success: true,
|
||||
downloadUrl: '/downloads/123.mp3',
|
||||
filename: 'audio.mp3',
|
||||
})
|
||||
|
||||
const request = createRequest({
|
||||
url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
||||
format: 'mp3',
|
||||
formatType: 'audio',
|
||||
})
|
||||
await POST(request)
|
||||
|
||||
expect(mockDownloadVideo).toHaveBeenCalledWith({
|
||||
url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
||||
format: 'mp3',
|
||||
formatType: 'audio',
|
||||
})
|
||||
})
|
||||
|
||||
it('handles exceptions gracefully', async () => {
|
||||
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
mockDownloadVideo.mockRejectedValue(new Error('Unexpected error'))
|
||||
|
||||
const request = createRequest({
|
||||
url: 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
||||
format: 'mp4',
|
||||
formatType: 'video',
|
||||
})
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(500)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Unexpected error')
|
||||
consoleSpy.mockRestore()
|
||||
})
|
||||
})
|
||||
89
app/api/info/route.test.ts
Normal file
89
app/api/info/route.test.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { POST } from './route'
|
||||
import { NextRequest } from 'next/server'
|
||||
|
||||
vi.mock('@/lib/youtube', () => ({
|
||||
getVideoInfo: vi.fn(),
|
||||
}))
|
||||
|
||||
import { getVideoInfo } from '@/lib/youtube'
|
||||
|
||||
const mockGetVideoInfo = vi.mocked(getVideoInfo)
|
||||
|
||||
function createRequest(body: object): NextRequest {
|
||||
return new NextRequest('http://localhost:3000/api/info', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
}
|
||||
|
||||
describe('POST /api/info', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('returns 400 when URL is missing', async () => {
|
||||
const request = createRequest({})
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(400)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('URL is required')
|
||||
})
|
||||
|
||||
it('returns 400 for invalid YouTube URL', async () => {
|
||||
const request = createRequest({ url: 'https://vimeo.com/123' })
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(400)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Invalid YouTube URL')
|
||||
})
|
||||
|
||||
it('returns 500 when getVideoInfo fails', async () => {
|
||||
mockGetVideoInfo.mockResolvedValue(null)
|
||||
|
||||
const request = createRequest({ url: 'https://youtube.com/watch?v=dQw4w9WgXcQ' })
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(500)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Failed to get video info')
|
||||
})
|
||||
|
||||
it('returns video info on success', async () => {
|
||||
const mockVideoInfo = {
|
||||
title: 'Test Video',
|
||||
duration: 180,
|
||||
thumbnail: 'https://example.com/thumb.jpg',
|
||||
formats: [],
|
||||
}
|
||||
mockGetVideoInfo.mockResolvedValue(mockVideoInfo)
|
||||
|
||||
const request = createRequest({ url: 'https://youtube.com/watch?v=dQw4w9WgXcQ' })
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(200)
|
||||
expect(data.success).toBe(true)
|
||||
expect(data.videoInfo).toEqual(mockVideoInfo)
|
||||
})
|
||||
|
||||
it('handles exceptions gracefully', async () => {
|
||||
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
mockGetVideoInfo.mockRejectedValue(new Error('Network error'))
|
||||
|
||||
const request = createRequest({ url: 'https://youtube.com/watch?v=dQw4w9WgXcQ' })
|
||||
const response = await POST(request)
|
||||
const data = await response.json()
|
||||
|
||||
expect(response.status).toBe(500)
|
||||
expect(data.success).toBe(false)
|
||||
expect(data.error).toBe('Network error')
|
||||
consoleSpy.mockRestore()
|
||||
})
|
||||
})
|
||||
281
app/page.test.tsx
Normal file
281
app/page.test.tsx
Normal file
@@ -0,0 +1,281 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { render, screen, fireEvent, waitFor, cleanup } from '@testing-library/react'
|
||||
import Home from './page'
|
||||
|
||||
global.fetch = vi.fn()
|
||||
|
||||
const mockFetch = vi.mocked(global.fetch)
|
||||
|
||||
describe('Home Page', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
cleanup()
|
||||
})
|
||||
|
||||
it('renders the main heading', () => {
|
||||
render(<Home />)
|
||||
expect(screen.getByText('Downlink')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders the URL input', () => {
|
||||
render(<Home />)
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
expect(inputs.length).toBeGreaterThanOrEqual(1)
|
||||
})
|
||||
|
||||
it('renders the Fetch button', () => {
|
||||
render(<Home />)
|
||||
const buttons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
expect(buttons.length).toBeGreaterThanOrEqual(1)
|
||||
})
|
||||
|
||||
it('shows error for empty URL on fetch', async () => {
|
||||
render(<Home />)
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Please enter a YouTube URL')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
it('shows error for invalid YouTube URL', async () => {
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://vimeo.com/123' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Please enter a valid YouTube URL')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
it('fetches video info for valid URL', async () => {
|
||||
const mockVideoInfo = {
|
||||
title: 'Test Video',
|
||||
duration: 180,
|
||||
thumbnail: 'https://example.com/thumb.jpg',
|
||||
}
|
||||
|
||||
mockFetch.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({ success: true, videoInfo: mockVideoInfo }),
|
||||
} as Response)
|
||||
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://youtube.com/watch?v=dQw4w9WgXcQ' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Test Video')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
expect(mockFetch).toHaveBeenCalledWith('/api/info', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url: 'https://youtube.com/watch?v=dQw4w9WgXcQ' }),
|
||||
})
|
||||
})
|
||||
|
||||
it('displays video duration after fetch', async () => {
|
||||
const mockVideoInfo = {
|
||||
title: 'Test Video',
|
||||
duration: 125,
|
||||
thumbnail: 'https://example.com/thumb.jpg',
|
||||
}
|
||||
|
||||
mockFetch.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({ success: true, videoInfo: mockVideoInfo }),
|
||||
} as Response)
|
||||
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://youtube.com/watch?v=dQw4w9WgXcQ' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('2:05')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
it('shows download options after fetching video info', async () => {
|
||||
const mockVideoInfo = {
|
||||
title: 'Test Video',
|
||||
duration: 180,
|
||||
thumbnail: 'https://example.com/thumb.jpg',
|
||||
}
|
||||
|
||||
mockFetch.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({ success: true, videoInfo: mockVideoInfo }),
|
||||
} as Response)
|
||||
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://youtube.com/watch?v=dQw4w9WgXcQ' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Download Options')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
it('handles API error response', async () => {
|
||||
mockFetch.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({ success: false, error: 'Video not found' }),
|
||||
} as Response)
|
||||
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://youtube.com/watch?v=dQw4w9WgXcQ' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Video not found')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
it('handles fetch network error', async () => {
|
||||
mockFetch.mockRejectedValueOnce(new Error('Network error'))
|
||||
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://youtube.com/watch?v=dQw4w9WgXcQ' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Network error')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
it('allows switching between video and audio format types', async () => {
|
||||
const mockVideoInfo = {
|
||||
title: 'Test Video',
|
||||
duration: 180,
|
||||
thumbnail: 'https://example.com/thumb.jpg',
|
||||
}
|
||||
|
||||
mockFetch.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({ success: true, videoInfo: mockVideoInfo }),
|
||||
} as Response)
|
||||
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://youtube.com/watch?v=dQw4w9WgXcQ' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Download Options')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
const audioButton = screen.getByRole('button', { name: /audio/i })
|
||||
fireEvent.click(audioButton)
|
||||
|
||||
expect(screen.getByText('Audio Format')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('triggers download on button click', async () => {
|
||||
const mockVideoInfo = {
|
||||
title: 'Test Video',
|
||||
duration: 180,
|
||||
thumbnail: 'https://example.com/thumb.jpg',
|
||||
}
|
||||
|
||||
mockFetch
|
||||
.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({ success: true, videoInfo: mockVideoInfo }),
|
||||
} as Response)
|
||||
.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({
|
||||
success: true,
|
||||
downloadUrl: '/downloads/test.mp4',
|
||||
filename: 'test.mp4',
|
||||
}),
|
||||
} as Response)
|
||||
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://youtube.com/watch?v=dQw4w9WgXcQ' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Download Options')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
const downloadButton = screen.getByRole('button', { name: /download mp4/i })
|
||||
fireEvent.click(downloadButton)
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockFetch).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
expect(mockFetch).toHaveBeenLastCalledWith('/api/download', expect.objectContaining({
|
||||
method: 'POST',
|
||||
}))
|
||||
})
|
||||
|
||||
it('shows success message after download completes', async () => {
|
||||
const mockVideoInfo = {
|
||||
title: 'Test Video',
|
||||
duration: 180,
|
||||
thumbnail: 'https://example.com/thumb.jpg',
|
||||
}
|
||||
|
||||
mockFetch
|
||||
.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({ success: true, videoInfo: mockVideoInfo }),
|
||||
} as Response)
|
||||
.mockResolvedValueOnce({
|
||||
json: () => Promise.resolve({
|
||||
success: true,
|
||||
downloadUrl: '/downloads/test.mp4',
|
||||
filename: 'test.mp4',
|
||||
}),
|
||||
} as Response)
|
||||
|
||||
render(<Home />)
|
||||
|
||||
const inputs = screen.getAllByPlaceholderText('Paste YouTube URL here...')
|
||||
fireEvent.change(inputs[0], { target: { value: 'https://youtube.com/watch?v=dQw4w9WgXcQ' } })
|
||||
|
||||
const fetchButtons = screen.getAllByRole('button', { name: /fetch/i })
|
||||
fireEvent.click(fetchButtons[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Download Options')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /download mp4/i }))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Ready to Download')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -7,7 +7,7 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/com
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Download, Loader2, Play, Music, Sparkles, Zap, Check } from 'lucide-react';
|
||||
import { isValidYouTubeUrl } from '@/lib/utils';
|
||||
import { isValidYouTubeUrl, formatDuration } from '@/lib/utils';
|
||||
import type { VideoInfo, DownloadResponse, VideoFormat, AudioFormat } from '@/lib/types';
|
||||
|
||||
export default function Home() {
|
||||
@@ -112,12 +112,6 @@ export default function Home() {
|
||||
}
|
||||
};
|
||||
|
||||
const formatDuration = (seconds: number) => {
|
||||
const mins = Math.floor(seconds / 60);
|
||||
const secs = Math.floor(seconds % 60);
|
||||
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-screen relative">
|
||||
{/* Animated background */}
|
||||
|
||||
Reference in New Issue
Block a user