--- t/50-strix.t 2008/06/16 16:48:16 174 +++ t/50-strix.t 2008/06/20 20:44:18 213 @@ -8,7 +8,7 @@ =cut -use Jifty::Test tests => 10; +use Jifty::Test tests => 21; use Data::Dump qw/dump/; @@ -26,6 +26,23 @@ ok( my $strix = Strix->new({ instance => $instance }), 'new' ); isa_ok( $strix, 'Strix' ); +# cache +ok( my $path = $strix->cache_path( 'test-%d-%s', 42, 'bar' ), 'cache_path' ); +like( $path, qr/test-42-bar$/, 'correct' ); + +my $data = 'scalar'; +SKIP: { +skip( 'scalars not supported', 2 ); +ok( $strix->write_cache( $data, 'test-scalar' ), 'write_cache scalar' ); +is_deeply( $strix->read_cache( 'test-scalar' ), $data, 'read_cache scalar' ); +} +$data = { foo => 42, bar => 'baz' }; +ok( $strix->write_cache( $data, 'test-hash' ), 'write_cache hash' ); +is_deeply( $strix->read_cache( 'test-hash' ), $data, 'read_cache hash' ); +$data = [ 1, 2, 42 ]; +ok( $strix->write_cache( $data, 'test-array' ), 'write_cache array' ); +is_deeply( $strix->read_cache( 'test-array' ), $data, 'read_cache array' ); + my $url = '/'; ok( my $category = $strix->category( $url ), "category $url" ); @@ -37,7 +54,11 @@ ok( $layout->{pre}, 'pre' ); ok( $layout->{free}, 'free' ); -my $site_id = 1; +ok( my @sites = $strix->sites, "sites" ); +diag dump( @sites ) if $debug; + +ok( my $nav = $strix->site_navigation( 1, 1 ), "site_navigation" ); +diag dump( $nav ) if $debug; -ok( my $sitemap = $strix->sitemap( $site_id ), "sitemap $site_id" ); -diag dump( $sitemap ) if $debug; +ok( my $nav2 = $strix->site_navigation( 1, 1 ), "site_navigation (again)" ); +is_deeply( $nav, $nav2, 'same' );