7 use_ok( 'SGN::SiteFeatures::CrossReference' );
9 my $mock_feature = Test::MockObject->new;
10 $mock_feature->set_always( 'feature_name', 'fakefeature' );
12 my $cr1 = SGN::SiteFeatures::CrossReference->new({
13 url => '/foo/bar.txt',
15 feature => $mock_feature,
18 my $cr2 = SGN::SiteFeatures::CrossReference->new({
19 url => '/foo/bar.txt',
21 feature => $mock_feature,
24 my $cr3 = SGN::SiteFeatures::CrossReference->new({
25 url => '/foo/baz.txt',
27 feature => $mock_feature,
30 ok( $cr2->cr_eq( $cr1 ), 'cr eq finds equal' );
31 ok( ! $cr2->cr_eq( $cr3 ), 'cr eq finds not equal' );
33 is( $cr2->cr_cmp( $cr1 ), 0, 'cr cmp for eq' );
34 is( $cr2->cr_cmp( $cr3 ), -1, 'cr cmp 1' );
35 is( $cr3->cr_cmp( $cr1 ), 1, 'cr cmp 2' );
37 my @u = $cr1->uniq( $cr2, $cr3 );
38 is( scalar(@u), 2, 'uniq seems to work 0' );
39 is( $cr1, $u[0], 'uniq seems to work 1' );
40 is( $cr3, $u[1], 'uniq seems to work 2' );
42 my $js_hash = $cr3->TO_JSON;
43 is( $js_hash->{text}, 'Noggin' );
44 can_ok( $js_hash->{url}, 'scheme', 'path' );
45 is( $js_hash->{feature}, 'fakefeature' );