2 use warnings FATAL => 'all';
8 use File::Temp qw(tempdir);
10 # Chdir to test directory for laziness
11 my $original_dir = getcwd;
16 my $temp_dir = tempdir(CLEANUP => 1);
19 use App::IdiotBox::Importer;
21 my $method = 'video_files_from_dir';
24 my $videos = App::IdiotBox::Importer->$method($temp_dir);
25 is_deeply($videos, {}, 'No files reported from empty directory');
28 open(undef, '>', 'fake.mp3');
29 open(undef, '>', 'fake2.aac');
31 $videos = App::IdiotBox::Importer->$method($temp_dir);
32 is_deeply($videos, {}, 'No files reported from empty directory');
35 open(undef, '>', 'good.m4v');
36 open(undef, '>', 'good2.flv');
43 $videos = App::IdiotBox::Importer->$method($temp_dir);
44 is_deeply($videos, $expect, 'Known filetypes detected');
46 # Grouping by file name without extension
47 open(undef, '>', 'good.flv');
49 unshift @{ $expect->{good} }, 'flv';
51 $videos = App::IdiotBox::Importer->$method($temp_dir);
52 is_deeply($videos, $expect, 'Known filetypes detected');