Merge pull request #4073 from solgenomics/topic/fix_another_type_id_issue
[sgn.git] / t / unit_mech / AJAX / Accession_usage.t
blob2d922e3072fdb574d959cb5f4b491520dbdca5f7
2 use strict;
3 use warnings;
5 use lib 't/lib';
6 use SGN::Test::Fixture;
7 use Test::More;
8 use Test::WWW::Mechanize;
10 use Data::Dumper;
11 use JSON;
12 local $Data::Dumper::Indent = 0;
14 my $f = SGN::Test::Fixture->new();
15 my $schema = $f->bcs_schema;
17 my $mech = Test::WWW::Mechanize->new;
18 my $response;
20 $mech->get_ok('http://localhost:3010/ajax/accession_usage_trials');
21 $response = decode_json $mech->content;
22 print STDERR Dumper $response;
23 my $data = $response->{data};
24 print STDERR Dumper scalar(@$data);
25 ok(scalar(@$data) == 439);
27 print STDERR Dumper $data->[0];
28 print STDERR "\n";
29 is_deeply($data->[0],
30 ['<a href="/stock/38878/view">UG120001</a>',3,6]
31 , 'first row');
34 print STDERR Dumper $data->[100];
35 print STDERR "\n";
36 is_deeply($data->[100],
37 ['<a href="/stock/38978/view">UG120115</a>',3,6]
38 , '101th row');
41 $mech->get_ok('http://localhost:3010/ajax/accession_usage_female');
42 $response = decode_json $mech->content;
43 print STDERR Dumper $response;
45 is_deeply($response,{'data' => [['<a href="/stock/38843/view">test_accession4</a>',15],['<a href="/stock/38840/view">test_accession1</a>',1],['<a href="/stock/38842/view">test_accession3</a>',1]]}, 'female usage');
48 $mech->get_ok('http://localhost:3010/ajax/accession_usage_male');
49 $response = decode_json $mech->content;
50 print STDERR Dumper $response;
52 is_deeply($response, {'data' => [['<a href="/stock/38844/view">test_accession5</a>',15],['<a href="/stock/38841/view">test_accession2</a>',1]]}, 'male usage');
54 $mech->get_ok('http://localhost:3010/ajax/accession_usage_phenotypes?display=plots_accession');
55 $response = decode_json $mech->content;
56 print STDERR Dumper $response;
57 print STDERR Dumper scalar(@{$response->{data}});
59 is(scalar(@{$response->{data}}), 1563, 'accession phenotypes usage');
62 done_testing();