<commit_before>use strict;
use warnings;
use Test::More tests => 6;

use lib 't/lib';
use SGN::Test::Data qw/ create_test /;
use Catalyst::Test 'SGN';
use Digest::SHA1 qw/sha1_hex/;
use Data::Dumper;

use_ok 'SGN::Controller::Bulk';
use aliased 'SGN::Test::WWW::Mechanize' => 'Mech';

my $mech = Mech->new;

$mech->with_test_level( local => sub {
    my $poly_cvterm     = create_test('Cv::Cvterm',        { name => 'gene' });
    my $poly_feature    = create_test('Sequence::Feature', { type => $poly_cvterm  });
    diag "Created gene " . $poly_feature->name;
    $mech->get('/bulk/gene');
    $mech->submit_form_ok({
        form_name => "bulk_gene",
        fields    => {
            ids => "Solyc02g081670.1",
        },
    }, "submit bulk_gene with a single valid identifier");
    my $sha1 = sha1_hex("Solyc02g081670.1");
    $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
    $mech->content_unlike(qr/Your query did not contain any valid identifiers/) or diag $mech->content;
    my @flinks = $mech->find_all_links( url_regex => qr{/bulk/gene/download/$sha1\.fasta} );
    cmp_ok(@flinks, '==', 1, "found one FASTA download link for $sha1.fasta");
    $mech->links_ok( \@flinks );

});<commit_msg>Add a failing test that checks for non-zero length fasta links<commit_after>use strict;
use warnings;
use Test::More tests => 7;

use lib 't/lib';
use SGN::Test::Data qw/ create_test /;
use Catalyst::Test 'SGN';
use Digest::SHA1 qw/sha1_hex/;
use Data::Dumper;

use_ok 'SGN::Controller::Bulk';
use aliased 'SGN::Test::WWW::Mechanize' => 'Mech';

my $mech = Mech->new;

$mech->with_test_level( local => sub {
    my $poly_cvterm     = create_test('Cv::Cvterm',        { name => 'gene' });
    my $poly_feature    = create_test('Sequence::Feature', { type => $poly_cvterm  });
    diag "Created gene " . $poly_feature->name;
    $mech->get('/bulk/gene');
    $mech->submit_form_ok({
        form_name => "bulk_gene",
        fields    => {
            ids => "Solyc02g081670.1",
        },
    }, "submit bulk_gene with a single valid identifier");
    my $sha1 = sha1_hex("Solyc02g081670.1");
    $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
    $mech->content_unlike(qr/Your query did not contain any valid identifiers/) or diag $mech->content;
    my @flinks = $mech->find_all_links( url_regex => qr{/bulk/gene/download/$sha1\.fasta} );
    cmp_ok(@flinks, '==', 1, "found one FASTA download link for $sha1.fasta");
    $mech->links_ok( \@flinks );

    map { cmp_ok(length($mech->get($_->url)->content), '>', 0, $_->url . " length > 0 ") } @flinks;

});
{'fraction_non_alphanumeric': 0.1780506523407521, 'fraction_numerical': 0.02072141212586339, 'mean_word_length': 3.589788732394366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '782794', 'n_tokens_mistral': 1018, 'n_tokens_neox': 967, 'n_words': 213}