2 |
|
|
3 |
use strict; |
use strict; |
4 |
|
|
5 |
use Test::More tests => 11; |
use Test::More tests => 13; |
6 |
use Test::Exception; |
use Test::Exception; |
7 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
8 |
use File::Temp qw/tempdir/; |
use File::Temp qw/tempdir/; |
30 |
|
|
31 |
ok(my $est = new WebPAC::Output::Estraier( %{ $config } ), "new WebPAC::Output::Estraier"); |
ok(my $est = new WebPAC::Output::Estraier( %{ $config } ), "new WebPAC::Output::Estraier"); |
32 |
|
|
|
ok(my $list = $est->master( action => 'nodelist' ), "nodelist"); |
|
|
|
|
|
like($list , qr/$config->{database}/, "found $config->{database}"); |
|
|
|
|
33 |
my $ds = { |
my $ds = { |
34 |
'Source' => { |
'Source' => { |
35 |
'name' => 'Izvor: ', |
'name' => 'Izvor: ', |
50 |
|
|
51 |
ok($est->add( id => 42, ds => $ds, type => 'search' ), "add"); |
ok($est->add( id => 42, ds => $ds, type => 'search' ), "add"); |
52 |
|
|
53 |
ok($est = new WebPAC::Search::Estraier( %{ $config } ), "new WebPAC::Search::Estraier"); |
ok(my $est_s = new WebPAC::Search::Estraier( %{ $config } ), "new WebPAC::Search::Estraier"); |
54 |
|
|
55 |
my $query = 'demo'; |
my $query = 'demo'; |
56 |
my $max = 1; |
my $max = 1; |
57 |
|
|
58 |
ok(my @res = $est->search( |
ok(my @res = $est_s->search( |
59 |
phrase => $query, |
phrase => $query, |
60 |
get_attr => [ qw/ID Source/ ], |
get_attr => [ qw/ID Source/ ], |
61 |
max => $max, |
max => $max, |
63 |
|
|
64 |
cmp_ok(($#res + 1), '==', $max, "$max hits"); |
cmp_ok(($#res + 1), '==', $max, "$max hits"); |
65 |
|
|
66 |
diag Dumper(\@res); |
ok($est->master( action => 'nodeadd', name => 'webpac2test_link', label => 'test' ), "nodeadd"); |
67 |
|
|
68 |
|
ok($est->add_link( from => 'webpac2test', to => 'webpac2test_link', credit => 42 ), "add_link"); |
69 |
|
|
70 |
|
ok($est->master( action => 'nodedel', name => 'webpac2test' ), "nodedel"); |
71 |
|
ok($est->master( action => 'nodedel', name => 'webpac2test_link' ), "nodedel"); |
72 |
|
|