#!/usr/bin/perl use strict; use warnings; use Test::More tests => 3; use File::Path qw(remove_tree); use File::Spec; use FindBin; use lib "$FindBin::Bin/../lib"; use Acme::Frobnitz; # Setup my $output_dir = "downloads"; remove_tree($output_dir) if -d $output_dir; # Clean up any previous downloads # Test 1: Ensure the method exists can_ok('Acme::Frobnitz', 'download'); # Test 2: Attempt to download a YouTube video my $youtube_link = 'https://www.youtube.com/shorts/CFqehDVY_zQ'; eval { Acme::Frobnitz->download($youtube_link); }; ok(!$@, "YouTube video download did not throw an error"); # Test 3: Verify output directory and files ok(-d $output_dir, "Output directory exists"); my @files = glob(File::Spec->catfile($output_dir, '*')); ok(@files > 0, "Downloaded files exist in the output directory"); # Teardown remove_tree($output_dir); # Clean up after test done_testing();